@perses-dev/timeseries-table-plugin 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/341.53436797.css +1 -0
  4. package/__mf/css/async/759.53436797.css +1 -0
  5. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  6. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  7. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  8. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  9. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  10. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  11. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  12. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  13. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  17. package/__mf/js/795.a00f14d5.js +5 -0
  18. package/__mf/js/TimeSeriesTable.78b6adc4.js +5 -0
  19. package/__mf/js/async/156.edaa1366.js +1 -0
  20. package/__mf/js/async/173.7677c422.js +2 -0
  21. package/__mf/js/async/173.7677c422.js.LICENSE.txt +19 -0
  22. package/__mf/js/async/570.4e5c2806.js +1 -0
  23. package/__mf/js/async/620.989f65d2.js +2 -0
  24. package/__mf/js/async/620.989f65d2.js.LICENSE.txt +9 -0
  25. package/__mf/js/async/621.966dfe80.js +111 -0
  26. package/__mf/js/async/621.966dfe80.js.LICENSE.txt +52 -0
  27. package/__mf/js/async/651.f2005980.js +1 -0
  28. package/__mf/js/async/694.46f61549.js +1 -0
  29. package/__mf/js/async/740.64988389.js +1 -0
  30. package/__mf/js/async/75.65fec995.js +1 -0
  31. package/__mf/js/async/770.46d7d5f9.js +1 -0
  32. package/__mf/js/async/960.d242a960.js +2 -0
  33. package/__mf/js/async/960.d242a960.js.LICENSE.txt +8 -0
  34. package/__mf/js/async/964.7386b918.js +2 -0
  35. package/__mf/js/async/964.7386b918.js.LICENSE.txt +9 -0
  36. package/__mf/js/async/998.e20cf478.js +65 -0
  37. package/__mf/js/async/998.e20cf478.js.LICENSE.txt +59 -0
  38. package/__mf/js/async/__federation_expose_TimeSeriesTable.0774ca0f.js +1 -0
  39. package/__mf/js/main.857476c9.js +1 -0
  40. package/lib/TimeSeriesTable.d.ts +8 -0
  41. package/lib/TimeSeriesTable.d.ts.map +1 -0
  42. package/lib/TimeSeriesTable.js +29 -0
  43. package/lib/TimeSeriesTable.js.map +1 -0
  44. package/lib/TimeSeriesTablePanel.d.ts +7 -0
  45. package/lib/TimeSeriesTablePanel.d.ts.map +1 -0
  46. package/lib/TimeSeriesTablePanel.js +33 -0
  47. package/lib/TimeSeriesTablePanel.js.map +1 -0
  48. package/lib/bootstrap.d.ts +2 -0
  49. package/lib/bootstrap.d.ts.map +1 -0
  50. package/lib/bootstrap.js +19 -0
  51. package/lib/bootstrap.js.map +1 -0
  52. package/lib/cjs/TimeSeriesTable.js +35 -0
  53. package/lib/cjs/TimeSeriesTablePanel.js +41 -0
  54. package/lib/cjs/bootstrap.js +26 -0
  55. package/lib/cjs/components/DataTable.js +185 -0
  56. package/lib/cjs/components/HistogramChart.js +121 -0
  57. package/lib/cjs/components/SeriesName.js +100 -0
  58. package/lib/cjs/components/index.js +20 -0
  59. package/lib/cjs/env.d.js +14 -0
  60. package/lib/cjs/getPluginModule.js +27 -0
  61. package/lib/cjs/index-federation.js +55 -0
  62. package/lib/cjs/index.js +29 -0
  63. package/lib/cjs/model.js +5 -0
  64. package/lib/cjs/setup-tests.js +19 -0
  65. package/lib/cjs/test/mock-query-results.js +417 -0
  66. package/lib/components/DataTable.d.ts +18 -0
  67. package/lib/components/DataTable.d.ts.map +1 -0
  68. package/lib/components/DataTable.js +173 -0
  69. package/lib/components/DataTable.js.map +1 -0
  70. package/lib/components/HistogramChart.d.ts +16 -0
  71. package/lib/components/HistogramChart.d.ts.map +1 -0
  72. package/lib/components/HistogramChart.js +113 -0
  73. package/lib/components/HistogramChart.js.map +1 -0
  74. package/lib/components/SeriesName.d.ts +11 -0
  75. package/lib/components/SeriesName.d.ts.map +1 -0
  76. package/lib/components/SeriesName.js +95 -0
  77. package/lib/components/SeriesName.js.map +1 -0
  78. package/lib/components/index.d.ts +4 -0
  79. package/lib/components/index.d.ts.map +1 -0
  80. package/lib/components/index.js +5 -0
  81. package/lib/components/index.js.map +1 -0
  82. package/lib/env.d.js +15 -0
  83. package/lib/env.d.js.map +1 -0
  84. package/lib/getPluginModule.d.ts +6 -0
  85. package/lib/getPluginModule.d.ts.map +1 -0
  86. package/lib/getPluginModule.js +16 -0
  87. package/lib/getPluginModule.js.map +1 -0
  88. package/lib/index-federation.d.ts +1 -0
  89. package/lib/index-federation.d.ts.map +1 -0
  90. package/lib/index-federation.js +15 -0
  91. package/lib/index-federation.js.map +1 -0
  92. package/lib/index.d.ts +7 -0
  93. package/lib/index.d.ts.map +1 -0
  94. package/lib/index.js +8 -0
  95. package/lib/index.js.map +1 -0
  96. package/lib/model.d.ts +3 -0
  97. package/lib/model.d.ts.map +1 -0
  98. package/lib/model.js +4 -0
  99. package/lib/model.js.map +1 -0
  100. package/lib/setup-tests.d.ts +2 -0
  101. package/lib/setup-tests.d.ts.map +1 -0
  102. package/lib/setup-tests.js +17 -0
  103. package/lib/setup-tests.js.map +1 -0
  104. package/lib/test/mock-query-results.d.ts +136 -0
  105. package/lib/test/mock-query-results.d.ts.map +1 -0
  106. package/lib/test/mock-query-results.js +389 -0
  107. package/lib/test/mock-query-results.js.map +1 -0
  108. package/mf-manifest.json +212 -0
  109. package/mf-stats.json +242 -0
  110. package/package.json +54 -0
@@ -0,0 +1,59 @@
1
+ /*!
2
+ * Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com>
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+ /*!
24
+ * decimal.js v10.5.0
25
+ * An arbitrary-precision Decimal type for JavaScript.
26
+ * https://github.com/MikeMcl/decimal.js
27
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
28
+ * MIT Licence
29
+ */
30
+
31
+ /**
32
+ * react-table
33
+ *
34
+ * Copyright (c) TanStack
35
+ *
36
+ * This source code is licensed under the MIT license found in the
37
+ * LICENSE.md file in the root directory of this source tree.
38
+ *
39
+ * @license MIT
40
+ */
41
+
42
+ /**
43
+ * table-core
44
+ *
45
+ * Copyright (c) TanStack
46
+ *
47
+ * This source code is licensed under the MIT license found in the
48
+ * LICENSE.md file in the root directory of this source tree.
49
+ *
50
+ * @license MIT
51
+ */
52
+
53
+ /**
54
+ * @license Fraction.js v4.3.7 31/08/2023
55
+ * https://www.xarg.org/2014/03/rational-numbers-in-javascript/
56
+ *
57
+ * Copyright (c) 2023, Robert Eisele (robert@raw.org)
58
+ * Dual licensed under the MIT or GPL Version 2 licenses.
59
+ **/
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkTimeSeriesTable=self.webpackChunkTimeSeriesTable||[]).push([["972"],{4417:function(e,t,s){s.r(t),s.d(t,{TimeSeriesTable:()=>w});var n=s(4246),r=s(6372),l=s(3941),i=s(4538),a=s(2054),o=s(315),c=s(190),h=s(6174),u=s(5283),d=s(4968),x=s(6205),m=s(1889);function p(e){let{name:t,labels:s,formattedName:r,isFormatted:l}=e;return l&&s&&Object.keys(s).length>0?(0,n.jsx)(j,{labels:s}):(0,n.jsx)(a.Z,{sx:{textWrap:"auto"},children:r??t})}function j(e){let{labels:t}=e,{infoSnackbar:s}=(0,l.useSnackbar)(),r=[],i=!0;function o(e){let t=e.currentTarget.innerText||"";navigator.clipboard.writeText(t.trim()).then(()=>{s(`Copied label matcher: ${t}`)}).catch(e=>{console.error(`unable to copy text: ${e}`)})}for(let e in t)"__name__"!==e&&(r.push((0,n.jsxs)("span",{children:[!i&&", ",(0,n.jsxs)(a.Z,{display:"inline",component:"span",sx:{"&:hover":{cursor:"pointer",textDecoration:"underline"}},onClick:o,title:"Click to copy label matcher",children:[(0,n.jsx)("strong",{children:e}),"=",(0,n.jsxs)("span",{children:['"',t[e],'"']})]})]},e)),i&&(i=!1));return(0,n.jsxs)(a.Z,{sx:{textWrap:"auto"},children:[t?t.__name__:"","{",r,"}"]})}var v=s(8286);function g(e){let{width:t,height:s,data:a}=e,o=(0,l.useChartsTheme)(),c=(0,i.useMemo)(()=>a?a.buckets.map(e=>{let[t,s,n,r]=e;return{value:[parseFloat(s),parseFloat(n),parseFloat(r),t],itemStyle:{color:o.echartsTheme[0]}}}):[],[o.echartsTheme,a]),h=(0,i.useMemo)(()=>{var e;return c?{title:{show:!1},tooltip:{},xAxis:{scale:!1,max:Math.ceil((null===(e=c[c.length-1])||void 0===e?void 0:e.value[1])??1)},yAxis:{},series:[{type:"custom",renderItem:function(e,t){var s,n;let r=t.value(2),l=t.coord([t.value(0),r]),i=null===(s=t.size)||void 0===s?void 0:s.call(t,[t.value(1)-t.value(0),r]),a=null===(n=t.style)||void 0===n?void 0:n.call(t);return{type:"rect",shape:{x:l[0],y:l[1],width:i[0],height:i[1]},style:a}},label:{show:!1},dimensions:["from","to"],encode:{x:[0,1],y:2,tooltip:[0,1],itemName:2},data:c}]}:o.noDataOption},[o.noDataOption,c]);return(0,n.jsx)(r.Z,{style:{width:t,height:s},sx:{overflow:"auto"},children:(0,n.jsx)(l.EChart,{sx:{minHeight:s},option:h,theme:o.echartsTheme})})}(0,s(6232).D)([v.N]);let Z=e=>{let{result:t}=e,s=(0,i.useMemo)(()=>t.flatMap(e=>e.data).flatMap(e=>(null==e?void 0:e.series)||[]),[t]),r=(0,i.useMemo)(()=>(function(e){let t=e.length<1e3;return e.map((e,s)=>{var r;let l=((null===(r=e.values)||void 0===r?void 0:r.length)??0)>1,o=e.values?e.values.map((e,t)=>(0,n.jsxs)(a.Z,{children:[e[1]," ",l&&(0,n.jsxs)("span",{children:["@",e[0]]})]},t)):[],c=e.histograms?e.histograms.map((e,t)=>(0,n.jsxs)(i.Fragment,{children:[(0,n.jsx)(g,{width:400,height:200,data:{buckets:e[1].buckets}})," ",(0,n.jsxs)(u.Z,{flexDirection:"row",justifyContent:"space-between",children:[(0,n.jsxs)(a.Z,{children:["Total count: ",e[1].count]}),(0,n.jsxs)(a.Z,{children:["Sum: ",e[1].sum]})]}),T(e[1])]},-t)):[];return(0,n.jsxs)(d.Z,{style:{whiteSpace:"pre"},children:[(0,n.jsx)(x.Z,{children:(0,n.jsx)(p,{name:e.name,formattedName:e.formattedName,labels:e.labels,isFormatted:t})}),(0,n.jsx)(x.Z,{children:e.histograms?c:o})]},s)})})(s),[s]);return t?(0,n.jsxs)(n.Fragment,{children:[s.length>=1e3&&(0,n.jsxs)(o.Z,{severity:"warning",children:["Showing more than ",1e3," series, turning off label formatting for performance reasons."]}),(0,n.jsx)(c.Z,{className:"data-table",children:(0,n.jsx)(h.Z,{children:r})})]}):(0,n.jsx)(a.Z,{children:"No data"})},f=e=>3===e||1===e?"[":"(",b=e=>3===e||0===e?"]":")",y=e=>{let[t,s,n]=e;return`${f(t)}${s} -> ${n}${b(t)}`},T=e=>{var t;return(0,n.jsxs)(c.Z,{children:[(0,n.jsx)(m.Z,{children:(0,n.jsx)(d.Z,{children:(0,n.jsx)(x.Z,{style:{textAlign:"center"},colSpan:2,children:"Histogram Sample"})})}),(0,n.jsxs)(h.Z,{children:[(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(x.Z,{children:"Range"}),(0,n.jsx)(x.Z,{children:"Count"})]}),null===(t=e.buckets)||void 0===t?void 0:t.map((e,t)=>(0,n.jsxs)(d.Z,{children:[(0,n.jsx)(x.Z,{children:y(e)}),(0,n.jsx)(x.Z,{children:e[3]})]},t))]})]})},w={PanelComponent:function(e){let{contentDimensions:t,queryResults:s}=e,i=(0,l.useChartsTheme)().container.padding.default;return(0,n.jsx)(r.Z,{sx:{height:(null==t?void 0:t.height)||0,padding:`${i}px`,overflowY:"scroll"},children:(0,n.jsx)(Z,{result:s})})},supportedQueryTypes:["TimeSeriesQuery"],queryOptions:{mode:"instant"},createInitialOptions:()=>({})}}}]);
@@ -0,0 +1 @@
1
+ (()=>{var e={5311:function(e,r,t){Promise.all([t.e("677"),t.e("179"),t.e("620")]).then(t.bind(t,9161))}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var a=r[n]={id:n,loaded:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}t.m=e,t.c=r,t.federation||(t.federation={chunkMatcher:function(e){return!/^(1(57|61|79)|494|677|759|946)$/.test(e)}}),t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.f={},t.e=e=>Promise.all(Object.keys(t.f).reduce((r,n)=>(t.f[n](e,r),r),[])),t.u=e=>"__mf/js/async/"+e+"."+({156:"edaa1366",173:"7677c422",620:"989f65d2",621:"966dfe80",651:"f2005980",694:"46f61549",740:"64988389",75:"65fec995",770:"46d7d5f9",960:"d242a960",964:"7386b918",998:"e20cf478"})[e]+".js",t.miniCssF=e=>"__mf/css/async/"+e+".53436797.css",t.h=()=>"83f38bab1a1df5d8",(()=>{t.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})()})(),t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e={},r="TimeSeriesTable:";t.l=function(n,o,a,i){if(e[n]){e[n].push(o);return}if(void 0!==a)for(var s,l,d=document.getElementsByTagName("script"),c=0;c<d.length;c++){var u=d[c];if(u.getAttribute("src")==n||u.getAttribute("data-webpack")==r+a){s=u;break}}s||(l=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,t.nc&&s.setAttribute("nonce",t.nc),s.setAttribute("data-webpack",r+a),s.src=n),e[n]=[o];var f=function(r,t){s.onerror=s.onload=null,clearTimeout(h);var o=e[n];if(delete e[n],s.parentNode&&s.parentNode.removeChild(s),o&&o.forEach(function(e){return e(t)}),r)return r(t)},h=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.bind(null,s.onload),l&&document.head.appendChild(s)}})(),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),t.nc=void 0,(()=>{var e=[];t.O=(r,n,o,a)=>{if(n){a=a||0;for(var i=e.length;i>0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[n,o,a];return}for(var s=1/0,i=0;i<e.length;i++){for(var[n,o,a]=e[i],l=!0,d=0;d<n.length;d++)(!1&a||s>=a)&&Object.keys(t.O).every(e=>t.O[e](n[d]))?n.splice(d--,1):(l=!1,a<s&&(s=a));if(l){e.splice(i--,1);var c=o();void 0!==c&&(r=c)}}return r}})(),t.p="/plugins/TimeSeriesTable/",t.rv=()=>"1.2.8",t.S={},t.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"@emotion/react",version:"11.14.0",factory:()=>Promise.all([t.e("960"),t.e("677"),t.e("651")]).then(()=>()=>t(6434)),eager:0,singleton:1,requiredVersion:"^11.11.3"},{name:"@emotion/styled",version:"11.14.0",factory:()=>Promise.all([t.e("677"),t.e("157"),t.e("770")]).then(()=>()=>t(1958)),eager:0,singleton:1},{name:"@perses-dev/components",version:"0.51.0-beta.1",factory:()=>Promise.all([t.e("156"),t.e("998"),t.e("621"),t.e("677"),t.e("179"),t.e("157"),t.e("161"),t.e("946"),t.e("759")]).then(()=>()=>t(3191)),eager:0,singleton:1},{name:"date-fns",version:"4.1.0",factory:()=>Promise.all([t.e("156"),t.e("75")]).then(()=>()=>t(9657)),eager:0,singleton:1},{name:"react-dom",version:"18.3.1",factory:()=>Promise.all([t.e("173"),t.e("677")]).then(()=>()=>t(2652)),eager:0,singleton:1,requiredVersion:"18.2.0"},{name:"react",version:"18.3.1",factory:()=>t.e("964").then(()=>()=>t(7378)),eager:0,singleton:1,requiredVersion:"18.2.0"}]},uniqueName:"TimeSeriesTable"},t.I=t.I||function(){throw Error("should have __webpack_require__.I")},t.consumesLoadingData={chunkMapping:{161:["4665","461"],494:["7871"],946:["5913"],179:["6085"],157:["2116"],677:["4538"]},moduleIdToConsumeDataMapping:{461:{shareScope:"default",shareKey:"date-fns",import:"date-fns",requiredVersion:"^4.1.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("75").then(()=>()=>t(9657))},5913:{shareScope:"default",shareKey:"@emotion/styled",import:"@emotion/styled",requiredVersion:"^11.3.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("694").then(()=>()=>t(1958))},4538:{shareScope:"default",shareKey:"react",import:"react",requiredVersion:"18.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("964").then(()=>()=>t(7378))},4665:{shareScope:"default",shareKey:"date-fns-tz",import:"date-fns-tz",requiredVersion:"^3.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>Promise.all([t.e("740"),t.e("494")]).then(()=>()=>t(8872))},7871:{shareScope:"default",shareKey:"date-fns",import:"date-fns",requiredVersion:"^3.0.0 || ^4.0.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("75").then(()=>()=>t(9657))},6085:{shareScope:"default",shareKey:"react-dom",import:"react-dom",requiredVersion:"18.2.0",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("173").then(()=>()=>t(2652))},2116:{shareScope:"default",shareKey:"@emotion/react",import:"@emotion/react",requiredVersion:"^11.11.3",strictVersion:!1,singleton:!0,eager:!1,fallback:()=>t.e("960").then(()=>()=>t(6434))}},initialConsumes:[]},t.f.consumes=t.f.consumes||function(){throw Error("should have __webpack_require__.f.consumes")},(()=>{if("undefined"!=typeof document){var e=function(e,r,n,o,a){var i=document.createElement("link");return i.rel="stylesheet",i.type="text/css",t.nc&&(i.nonce=t.nc),i.onerror=i.onload=function(t){if(i.onerror=i.onload=null,"load"===t.type)o();else{var n=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.href||r,l=Error("Loading CSS chunk "+e+" failed.\\n("+s+")");l.code="CSS_CHUNK_LOAD_FAILED",l.type=n,l.request=s,i.parentNode&&i.parentNode.removeChild(i),a(l)}},i.href=r,n?n.parentNode.insertBefore(i,n.nextSibling):document.head.appendChild(i),i},r=function(e,r){for(var t=document.getElementsByTagName("link"),n=0;n<t.length;n++){var o=t[n],a=o.getAttribute("data-href")||o.getAttribute("href");if("stylesheet"===o.rel&&(a===e||a===r))return o}for(var i=document.getElementsByTagName("style"),n=0;n<i.length;n++){var o=i[n],a=o.getAttribute("data-href");if(a===e||a===r)return o}},n={909:0};t.f.miniCss=function(o,a){if(n[o])a.push(n[o]);else if(0!==n[o]&&({759:1})[o])a.push(n[o]=new Promise(function(n,a){var i=t.miniCssF(o),s=t.p+i;if(r(i,s))return n();e(o,s,null,n,a)}).then(function(){n[o]=0},function(e){throw delete n[o],e}))}}})(),(()=>{var e={909:0};t.f.j=function(r,n){var o=t.o(e,r)?e[r]:void 0;if(0!==o){if(o)n.push(o[2]);else if(/^(1(57|61|79)|494|677|759|946)$/.test(r))e[r]=0;else{var a=new Promise((t,n)=>o=e[r]=[t,n]);n.push(o[2]=a);var i=t.p+t.u(r),s=Error();t.l(i,function(n){if(t.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;s.message="Loading chunk "+r+" failed.\n("+a+": "+i+")",s.name="ChunkLoadError",s.type=a,s.request=i,o[1](s)}},"chunk-"+r,r)}}},t.O.j=r=>0===e[r];var r=(r,n)=>{var o,a,[i,s,l]=n,d=0;if(i.some(r=>0!==e[r])){for(o in s)t.o(s,o)&&(t.m[o]=s[o]);if(l)var c=l(t)}for(r&&r(n);d<i.length;d++)a=i[d],t.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return t.O(c)},n=self.webpackChunkTimeSeriesTable=self.webpackChunkTimeSeriesTable||[];n.forEach(r.bind(null,0)),n.push=r.bind(null,n.push.bind(n))})(),t.ruid="bundler=rspack@1.2.8",t.O(void 0,["795"],function(){return t(2032)});var n=t.O(void 0,["795"],function(){return t(5311)});n=t.O(n)})();
@@ -0,0 +1,8 @@
1
+ import { PanelPlugin } from '@perses-dev/plugin-system';
2
+ import { TimeSeriesTableProps } from './TimeSeriesTablePanel';
3
+ import { TimeSeriesTableOptions } from './model';
4
+ /**
5
+ * The core TimeSeriesTable panel plugin for Perses.
6
+ */
7
+ export declare const TimeSeriesTable: PanelPlugin<TimeSeriesTableOptions, TimeSeriesTableProps>;
8
+ //# sourceMappingURL=TimeSeriesTable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeSeriesTable.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTable.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAwB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,sBAAsB,EAAE,oBAAoB,CASrF,CAAC"}
@@ -0,0 +1,29 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { TimeSeriesTablePanel } from './TimeSeriesTablePanel';
14
+ /**
15
+ * The core TimeSeriesTable panel plugin for Perses.
16
+ */ export const TimeSeriesTable = {
17
+ PanelComponent: TimeSeriesTablePanel,
18
+ supportedQueryTypes: [
19
+ 'TimeSeriesQuery'
20
+ ],
21
+ queryOptions: {
22
+ mode: 'instant'
23
+ },
24
+ createInitialOptions: ()=>{
25
+ return {};
26
+ }
27
+ };
28
+
29
+ //# sourceMappingURL=TimeSeriesTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTable.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelPlugin } from '@perses-dev/plugin-system';\nimport { TimeSeriesTablePanel, TimeSeriesTableProps } from './TimeSeriesTablePanel';\nimport { TimeSeriesTableOptions } from './model';\n\n/**\n * The core TimeSeriesTable panel plugin for Perses.\n */\nexport const TimeSeriesTable: PanelPlugin<TimeSeriesTableOptions, TimeSeriesTableProps> = {\n PanelComponent: TimeSeriesTablePanel,\n supportedQueryTypes: ['TimeSeriesQuery'],\n queryOptions: {\n mode: 'instant',\n },\n createInitialOptions: () => {\n return {};\n },\n};\n"],"names":["TimeSeriesTablePanel","TimeSeriesTable","PanelComponent","supportedQueryTypes","queryOptions","mode","createInitialOptions"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,oBAAoB,QAA8B,yBAAyB;AAGpF;;CAEC,GACD,OAAO,MAAMC,kBAA6E;IACxFC,gBAAgBF;IAChBG,qBAAqB;QAAC;KAAkB;IACxCC,cAAc;QACZC,MAAM;IACR;IACAC,sBAAsB;QACpB,OAAO,CAAC;IACV;AACF,EAAE"}
@@ -0,0 +1,7 @@
1
+ import { ReactElement } from 'react';
2
+ import { PanelProps } from '@perses-dev/plugin-system';
3
+ import { TimeSeriesData } from '@perses-dev/core';
4
+ import { TimeSeriesTableOptions } from './model';
5
+ export type TimeSeriesTableProps = PanelProps<TimeSeriesTableOptions, TimeSeriesData>;
6
+ export declare function TimeSeriesTablePanel(props: TimeSeriesTableProps): ReactElement;
7
+ //# sourceMappingURL=TimeSeriesTablePanel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeSeriesTablePanel.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTablePanel.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGjD,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;AAEtF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB,GAAG,YAAY,CAU9E"}
@@ -0,0 +1,33 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { Box } from '@mui/material';
15
+ import { useChartsTheme } from '@perses-dev/components';
16
+ import { DataTable } from './components';
17
+ export function TimeSeriesTablePanel(props) {
18
+ const { contentDimensions, queryResults } = props;
19
+ const chartsTheme = useChartsTheme();
20
+ const contentPadding = chartsTheme.container.padding.default;
21
+ return /*#__PURE__*/ _jsx(Box, {
22
+ sx: {
23
+ height: contentDimensions?.height || 0,
24
+ padding: `${contentPadding}px`,
25
+ overflowY: 'scroll'
26
+ },
27
+ children: /*#__PURE__*/ _jsx(DataTable, {
28
+ result: queryResults
29
+ })
30
+ });
31
+ }
32
+
33
+ //# sourceMappingURL=TimeSeriesTablePanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/TimeSeriesTablePanel.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Box } from '@mui/material';\nimport { useChartsTheme } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport { TimeSeriesData } from '@perses-dev/core';\nimport { TimeSeriesTableOptions } from './model';\nimport { DataTable } from './components';\n\nexport type TimeSeriesTableProps = PanelProps<TimeSeriesTableOptions, TimeSeriesData>;\n\nexport function TimeSeriesTablePanel(props: TimeSeriesTableProps): ReactElement {\n const { contentDimensions, queryResults } = props;\n const chartsTheme = useChartsTheme();\n const contentPadding = chartsTheme.container.padding.default;\n\n return (\n <Box sx={{ height: contentDimensions?.height || 0, padding: `${contentPadding}px`, overflowY: 'scroll' }}>\n <DataTable result={queryResults} />\n </Box>\n );\n}\n"],"names":["Box","useChartsTheme","DataTable","TimeSeriesTablePanel","props","contentDimensions","queryResults","chartsTheme","contentPadding","container","padding","default","sx","height","overflowY","result"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,cAAc,QAAQ,yBAAyB;AAKxD,SAASC,SAAS,QAAQ,eAAe;AAIzC,OAAO,SAASC,qBAAqBC,KAA2B;IAC9D,MAAM,EAAEC,iBAAiB,EAAEC,YAAY,EAAE,GAAGF;IAC5C,MAAMG,cAAcN;IACpB,MAAMO,iBAAiBD,YAAYE,SAAS,CAACC,OAAO,CAACC,OAAO;IAE5D,qBACE,KAACX;QAAIY,IAAI;YAAEC,QAAQR,mBAAmBQ,UAAU;YAAGH,SAAS,GAAGF,eAAe,EAAE,CAAC;YAAEM,WAAW;QAAS;kBACrG,cAAA,KAACZ;YAAUa,QAAQT;;;AAGzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bootstrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/bootstrap.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import React from 'react';
15
+ import ReactDOM from 'react-dom/client';
16
+ const root = ReactDOM.createRoot(document.getElementById('root'));
17
+ root.render(/*#__PURE__*/ _jsx(React.StrictMode, {}));
18
+
19
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bootstrap.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport React from 'react';\nimport ReactDOM from 'react-dom/client';\n\nconst root = ReactDOM.createRoot(document.getElementById('root')!);\nroot.render(<React.StrictMode></React.StrictMode>);\n"],"names":["React","ReactDOM","root","createRoot","document","getElementById","render","StrictMode"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,OAAOA,WAAW,QAAQ;AAC1B,OAAOC,cAAc,mBAAmB;AAExC,MAAMC,OAAOD,SAASE,UAAU,CAACC,SAASC,cAAc,CAAC;AACzDH,KAAKI,MAAM,eAAC,KAACN,MAAMO,UAAU"}
@@ -0,0 +1,35 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "TimeSeriesTable", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return TimeSeriesTable;
21
+ }
22
+ });
23
+ const _TimeSeriesTablePanel = require("./TimeSeriesTablePanel");
24
+ const TimeSeriesTable = {
25
+ PanelComponent: _TimeSeriesTablePanel.TimeSeriesTablePanel,
26
+ supportedQueryTypes: [
27
+ 'TimeSeriesQuery'
28
+ ],
29
+ queryOptions: {
30
+ mode: 'instant'
31
+ },
32
+ createInitialOptions: ()=>{
33
+ return {};
34
+ }
35
+ };
@@ -0,0 +1,41 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "TimeSeriesTablePanel", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return TimeSeriesTablePanel;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _components = require("@perses-dev/components");
26
+ const _components1 = require("./components");
27
+ function TimeSeriesTablePanel(props) {
28
+ const { contentDimensions, queryResults } = props;
29
+ const chartsTheme = (0, _components.useChartsTheme)();
30
+ const contentPadding = chartsTheme.container.padding.default;
31
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
32
+ sx: {
33
+ height: contentDimensions?.height || 0,
34
+ padding: `${contentPadding}px`,
35
+ overflowY: 'scroll'
36
+ },
37
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components1.DataTable, {
38
+ result: queryResults
39
+ })
40
+ });
41
+ }
@@ -0,0 +1,26 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ const _jsxruntime = require("react/jsx-runtime");
18
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
19
+ const _client = /*#__PURE__*/ _interop_require_default(require("react-dom/client"));
20
+ function _interop_require_default(obj) {
21
+ return obj && obj.__esModule ? obj : {
22
+ default: obj
23
+ };
24
+ }
25
+ const root = _client.default.createRoot(document.getElementById('root'));
26
+ root.render(/*#__PURE__*/ (0, _jsxruntime.jsx)(_react.default.StrictMode, {}));
@@ -0,0 +1,185 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ DataTable: function() {
25
+ return DataTable;
26
+ },
27
+ bucketRangeString: function() {
28
+ return bucketRangeString;
29
+ },
30
+ histogramTable: function() {
31
+ return histogramTable;
32
+ }
33
+ });
34
+ const _jsxruntime = require("react/jsx-runtime");
35
+ const _react = require("react");
36
+ const _material = require("@mui/material");
37
+ const _SeriesName = require("./SeriesName");
38
+ const _HistogramChart = require("./HistogramChart");
39
+ const MAX_FORMATABLE_SERIES = 1000;
40
+ const DataTable = ({ result })=>{
41
+ const series = (0, _react.useMemo)(()=>result.flatMap((d)=>d.data).flatMap((d)=>d?.series || []), [
42
+ result
43
+ ]);
44
+ const rows = (0, _react.useMemo)(()=>buildRows(series), [
45
+ series
46
+ ]);
47
+ if (!result) {
48
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
49
+ children: "No data"
50
+ });
51
+ }
52
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
53
+ children: [
54
+ series.length >= MAX_FORMATABLE_SERIES && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Alert, {
55
+ severity: "warning",
56
+ children: [
57
+ "Showing more than ",
58
+ MAX_FORMATABLE_SERIES,
59
+ " series, turning off label formatting for performance reasons."
60
+ ]
61
+ }),
62
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Table, {
63
+ className: "data-table",
64
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableBody, {
65
+ children: rows
66
+ })
67
+ })
68
+ ]
69
+ });
70
+ };
71
+ function buildRows(series) {
72
+ const isFormatted = series.length < MAX_FORMATABLE_SERIES; // only format series names if we have less than 1000 series for performance reasons
73
+ return series.map((s, seriesIdx)=>{
74
+ const displayTimeStamps = (s.values?.length ?? 0) > 1;
75
+ const valuesAndTimes = s.values ? s.values.map((v, valIdx)=>{
76
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
77
+ children: [
78
+ v[1],
79
+ " ",
80
+ displayTimeStamps && /*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
81
+ children: [
82
+ "@",
83
+ v[0]
84
+ ]
85
+ })
86
+ ]
87
+ }, valIdx);
88
+ }) : [];
89
+ const histogramsAndTimes = s.histograms ? s.histograms.map((h, hisIdx)=>{
90
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_react.Fragment, {
91
+ children: [
92
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_HistogramChart.HistogramChart, {
93
+ width: 400,
94
+ height: 200,
95
+ data: {
96
+ buckets: h[1].buckets
97
+ }
98
+ }),
99
+ " ",
100
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
101
+ flexDirection: "row",
102
+ justifyContent: "space-between",
103
+ children: [
104
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
105
+ children: [
106
+ "Total count: ",
107
+ h[1].count
108
+ ]
109
+ }),
110
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
111
+ children: [
112
+ "Sum: ",
113
+ h[1].sum
114
+ ]
115
+ })
116
+ ]
117
+ }),
118
+ histogramTable(h[1])
119
+ ]
120
+ }, -hisIdx);
121
+ }) : [];
122
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
123
+ style: {
124
+ whiteSpace: 'pre'
125
+ },
126
+ children: [
127
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
128
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_SeriesName.SeriesName, {
129
+ name: s.name,
130
+ formattedName: s.formattedName,
131
+ labels: s.labels,
132
+ isFormatted: isFormatted
133
+ })
134
+ }),
135
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
136
+ children: s.histograms ? histogramsAndTimes : valuesAndTimes
137
+ })
138
+ ]
139
+ }, seriesIdx);
140
+ });
141
+ }
142
+ const leftDelim = (br)=>br === 3 || br === 1 ? '[' : '(';
143
+ const rightDelim = (br)=>br === 3 || br === 0 ? ']' : ')';
144
+ const bucketRangeString = ([boundaryRule, leftBoundary, rightBoundary])=>{
145
+ return `${leftDelim(boundaryRule)}${leftBoundary} -> ${rightBoundary}${rightDelim(boundaryRule)}`;
146
+ };
147
+ const histogramTable = (h)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Table, {
148
+ children: [
149
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableHead, {
150
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableRow, {
151
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
152
+ style: {
153
+ textAlign: 'center'
154
+ },
155
+ colSpan: 2,
156
+ children: "Histogram Sample"
157
+ })
158
+ })
159
+ }),
160
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableBody, {
161
+ children: [
162
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
163
+ children: [
164
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
165
+ children: "Range"
166
+ }),
167
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
168
+ children: "Count"
169
+ })
170
+ ]
171
+ }),
172
+ h.buckets?.map((b, i)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TableRow, {
173
+ children: [
174
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
175
+ children: bucketRangeString(b)
176
+ }),
177
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TableCell, {
178
+ children: b[3]
179
+ })
180
+ ]
181
+ }, i))
182
+ ]
183
+ })
184
+ ]
185
+ });
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "HistogramChart", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return HistogramChart;
9
+ }
10
+ });
11
+ const _jsxruntime = require("react/jsx-runtime");
12
+ const _material = require("@mui/material");
13
+ const _components = require("@perses-dev/components");
14
+ const _charts = require("echarts/charts");
15
+ const _core = require("echarts/core");
16
+ const _react = require("react");
17
+ (0, _core.use)([
18
+ _charts.CustomChart
19
+ ]);
20
+ function HistogramChart({ width, height, data }) {
21
+ const chartsTheme = (0, _components.useChartsTheme)();
22
+ const transformedData = (0, _react.useMemo)(()=>{
23
+ if (!data) return [];
24
+ return data.buckets.map(([bucket, upperBound, lowerBound, count])=>{
25
+ return {
26
+ value: [
27
+ parseFloat(upperBound),
28
+ parseFloat(lowerBound),
29
+ parseFloat(count),
30
+ bucket
31
+ ],
32
+ itemStyle: {
33
+ color: chartsTheme.echartsTheme[0]
34
+ }
35
+ };
36
+ });
37
+ }, [
38
+ chartsTheme.echartsTheme,
39
+ data
40
+ ]);
41
+ const option = (0, _react.useMemo)(()=>{
42
+ if (!transformedData) return chartsTheme.noDataOption;
43
+ return {
44
+ title: {
45
+ show: false
46
+ },
47
+ tooltip: {},
48
+ xAxis: {
49
+ scale: false,
50
+ max: Math.ceil(transformedData[transformedData.length - 1]?.value[1] ?? 1)
51
+ },
52
+ yAxis: {},
53
+ series: [
54
+ {
55
+ type: 'custom',
56
+ renderItem: function(params, api) {
57
+ const yValue = api.value(2);
58
+ const start = api.coord([
59
+ api.value(0),
60
+ yValue
61
+ ]);
62
+ const size = api.size?.([
63
+ api.value(1) - api.value(0),
64
+ yValue
65
+ ]);
66
+ const style = api.style?.();
67
+ return {
68
+ type: 'rect',
69
+ shape: {
70
+ x: start[0],
71
+ y: start[1],
72
+ width: size[0],
73
+ height: size[1]
74
+ },
75
+ style: style
76
+ };
77
+ },
78
+ label: {
79
+ show: false
80
+ },
81
+ dimensions: [
82
+ 'from',
83
+ 'to'
84
+ ],
85
+ encode: {
86
+ x: [
87
+ 0,
88
+ 1
89
+ ],
90
+ y: 2,
91
+ tooltip: [
92
+ 0,
93
+ 1
94
+ ],
95
+ itemName: 2
96
+ },
97
+ data: transformedData
98
+ }
99
+ ]
100
+ };
101
+ }, [
102
+ chartsTheme.noDataOption,
103
+ transformedData
104
+ ]);
105
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
106
+ style: {
107
+ width: width,
108
+ height: height
109
+ },
110
+ sx: {
111
+ overflow: 'auto'
112
+ },
113
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.EChart, {
114
+ sx: {
115
+ minHeight: height
116
+ },
117
+ option: option,
118
+ theme: chartsTheme.echartsTheme
119
+ })
120
+ });
121
+ }