@perses-dev/table-plugin 0.11.0-rc.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{Table.b77753d3.js → Table.2fc0ce5e.js} +3 -3
- package/__mf/js/async/1117.b21b0ae4.js +2 -0
- package/__mf/js/async/392.49e51fc5.js +2 -0
- package/__mf/js/async/4510.a0a1dd48.js +7 -0
- package/__mf/js/async/54.467c4f98.js +22 -0
- package/__mf/js/async/{9010.cdee638b.js → 9010.fd805430.js} +1 -1
- package/__mf/js/async/{__federation_expose_Table.228a9ca2.js → __federation_expose_Table.b3466cfe.js} +1 -1
- package/__mf/js/{main.d633ae62.js → main.83aeba98.js} +3 -3
- package/mf-manifest.json +18 -18
- package/mf-stats.json +18 -18
- package/package.json +5 -5
- package/__mf/js/async/1117.5c24e598.js +0 -2
- package/__mf/js/async/392.c2307fe5.js +0 -2
- package/__mf/js/async/4510.3294904b.js +0 -7
- package/__mf/js/async/54.a32bcc37.js +0 -22
- /package/__mf/js/async/{1117.5c24e598.js.LICENSE.txt → 1117.b21b0ae4.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.c2307fe5.js.LICENSE.txt → 392.49e51fc5.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4510.3294904b.js.LICENSE.txt → 4510.a0a1dd48.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{54.a32bcc37.js.LICENSE.txt → 54.467c4f98.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.chunk_Table=self.chunk_Table||[]).push([["2669"],{80881:function(e,t,n){n.r(t),n.d(t,{Table:()=>G});var l=n(62540),i=n(70451),o=n.n(i),r=n(54381),a=n(315),s=n(93648),c=n(97653),d=n(88091),u=n(47095),h=n(65211),p=n(6227),g=n(7013),x=n(86067),m=n(86742),f=n(51867);function v(e,t){for(let l of t)if(function(e,t){var n,l,i,o,r,a,s;switch(e.kind){case"Value":return(null==(n=e.spec)?void 0:n.value)===String(t);case"Range":{if(Number.isNaN(Number(t)))return!1;let n=Number(t);if((null==(l=e.spec)?void 0:l.min)!==void 0&&(null==(i=e.spec)?void 0:i.max)!==void 0)return n>=+e.spec.min&&n<=+e.spec.max;if((null==(o=e.spec)?void 0:o.min)!==void 0)return n>=+e.spec.min;if((null==(r=e.spec)?void 0:r.max)!==void 0)return n<=+e.spec.max;return!1}case"Regex":if(!(null==(a=e.spec)?void 0:a.expr))return!1;try{return new RegExp(e.spec.expr).test(String(t))}catch{return!1}case"Misc":switch(null==(s=e.spec)?void 0:s.value){case"empty":return""===t;case"null":return null==t;case"NaN":return Number.isNaN(t);case"true":return!0===t;case"false":return!1===t;default:return!1}default:return!1}}(l.condition,e)){let t;if("Misc"===l.condition.kind){var n;switch(null==(n=l.condition.spec)?void 0:n.value){case"null":t="null";break;case"NaN":t="NaN"}}return function(e,t,n){let l=t.text||n||String(e);return{text:`${t.prefix??""}${l}${t.suffix??""}`,textColor:t.textColor,backgroundColor:t.backgroundColor}}(e,l,t)}}function j(e){let{cell:t,onChange:n,onDelete:i,...p}=e;return(0,l.jsxs)(r.A,{container:!0,spacing:2,...p,children:[(0,l.jsx)(r.A,{size:{xs:5},children:(0,l.jsxs)(a.A,{direction:"row",gap:1,width:"100%",children:[(0,l.jsxs)(s.A,{select:!0,label:"Type",value:t.condition.kind,onChange:e=>n({...t,condition:{kind:e.target.value}}),required:!0,sx:{width:"120px"},children:[(0,l.jsx)(c.A,{value:"Value",children:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.A,{children:"Value"}),"Value"!==t.condition.kind&&(0,l.jsx)(d.A,{variant:"caption",children:"Matches an exact text value"})]})}),(0,l.jsx)(c.A,{value:"Range",children:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.A,{children:"Range"}),"Range"!==t.condition.kind&&(0,l.jsx)(d.A,{variant:"caption",children:"Matches against a numerical range"})]})}),(0,l.jsx)(c.A,{value:"Regex",children:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.A,{children:"Regex"}),"Regex"!==t.condition.kind&&(0,l.jsx)(d.A,{variant:"caption",children:"Matches against a regular expression"})]})}),(0,l.jsx)(c.A,{value:"Misc",children:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.A,{children:"Misc"}),"Misc"!==t.condition.kind&&(0,l.jsx)(d.A,{variant:"caption",children:"Matches against empty, null and NaN values"})]})})]}),function(e,t){var n,l,i,r,u;let h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"small";return"Value"===e.kind?o().createElement(s.A,{label:"Value",placeholder:"Exact value",value:(null==(n=e.spec)?void 0:n.value)??"",onChange:n=>t({...e,spec:{value:n.target.value}}),fullWidth:!0,size:h}):"Range"===e.kind?o().createElement(a.A,{gap:1,direction:"row"},[o().createElement(s.A,{key:"min",label:"From",placeholder:"Start of range",value:(null==(l=e.spec)?void 0:l.min)??"",onChange:n=>t({...e,spec:{...e.spec,min:+n.target.value}}),fullWidth:!0,size:h}),o().createElement(s.A,{key:"max",label:"To",placeholder:"End of range (inclusive)",value:(null==(i=e.spec)?void 0:i.max)??"",onChange:n=>t({...e,spec:{...e.spec,max:+n.target.value}}),fullWidth:!0,size:h})]):"Regex"===e.kind?o().createElement(s.A,{label:"Regular Expression",placeholder:"JavaScript regular expression",value:(null==(r=e.spec)?void 0:r.expr)??"",onChange:n=>t({...e,spec:{expr:n.target.value}}),fullWidth:!0,size:h}):"Misc"===e.kind?o().createElement(s.A,{select:!0,label:"Value",value:(null==(u=e.spec)?void 0:u.value)??"",onChange:n=>t({...e,spec:{value:n.target.value}}),fullWidth:!0,size:h},[{value:"empty",label:"Empty",caption:"Matches empty string"},{value:"null",label:"Null",caption:"Matches null or undefined"},{value:"NaN",label:"NaN",caption:"Matches Not a Number value"},{value:"true",label:"True",caption:"Matches true boolean"},{value:"false",label:"False",caption:"Matches false boolean"}].map(e=>o().createElement(c.A,{key:e.value,value:e.value},o().createElement(a.A,{key:"stack"},[o().createElement(d.A,{key:"title"},e.label),o().createElement(d.A,{key:"caption",variant:"caption"},e.caption)])))):null}(t.condition,e=>n({...t,condition:e}),"small")]})}),(0,l.jsx)(r.A,{size:{xs:4},children:(0,l.jsxs)(a.A,{spacing:1,children:[(0,l.jsx)(s.A,{label:"Display text",value:t.text,onChange:e=>n({...t,text:e.target.value}),fullWidth:!0,size:"small"}),(0,l.jsxs)(a.A,{direction:"row",spacing:1,children:[(0,l.jsx)(s.A,{label:"Prefix",placeholder:"$",value:t.prefix??"",onChange:e=>n({...t,prefix:e.target.value}),size:"small"}),(0,l.jsx)(s.A,{label:"Suffix",placeholder:"%",value:t.suffix??"",onChange:e=>n({...t,suffix:e.target.value}),size:"small"})]})]})}),(0,l.jsx)(r.A,{size:{xs:1},children:(0,l.jsx)(a.A,{direction:"row",justifyContent:"center",gap:1,children:t.textColor?(0,l.jsx)(f.OptionsColorPicker,{label:"Text Color",color:t.textColor??"#000",onColorChange:e=>n({...t,textColor:e}),onClear:()=>n({...t,textColor:void 0})}):(0,l.jsx)(u.A,{onClick:()=>n({...t,textColor:"#000"}),children:(0,l.jsx)(m.default,{})})})}),(0,l.jsx)(r.A,{size:{xs:1},children:(0,l.jsx)(a.A,{direction:"row",justifyContent:"center",children:t.backgroundColor?(0,l.jsx)(f.OptionsColorPicker,{label:"Background Color",color:t.backgroundColor??"#fff",onColorChange:e=>n({...t,backgroundColor:e}),onClear:()=>n({...t,backgroundColor:void 0})}):(0,l.jsx)(u.A,{onClick:()=>n({...t,backgroundColor:"#000"}),children:(0,l.jsx)(m.default,{})})})}),(0,l.jsx)(r.A,{size:{xs:1},textAlign:"end",children:(0,l.jsx)(h.A,{title:"Remove cell settings",placement:"top",children:(0,l.jsx)(u.A,{size:"small",sx:{marginLeft:"auto"},onClick:i,children:(0,l.jsx)(x.default,{})},"delete-cell-button")})})]})}function C(e){let{cellSettings:t=[],onChange:n,addButtonText:i="Add Conditional Format"}=e;return(0,l.jsxs)(a.A,{spacing:3,sx:{mt:2},children:[(0,l.jsxs)(r.A,{container:!0,spacing:3,children:[(0,l.jsx)(r.A,{size:{xs:5},children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Condition"})}),(0,l.jsx)(r.A,{size:{xs:4},children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Display Text"})}),(0,l.jsx)(r.A,{size:{xs:1},textAlign:"center",children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Color"})}),(0,l.jsx)(r.A,{size:{xs:1},textAlign:"center",children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Background"})}),(0,l.jsx)(r.A,{size:{xs:1}})]}),(0,l.jsx)(a.A,{gap:1.5,divider:(0,l.jsx)(p.A,{flexItem:!0,orientation:"horizontal"}),children:t.map((e,i)=>(0,l.jsx)(j,{cell:e,onChange:e=>{let l;(l=[...t])[i]=e,n(l)},onDelete:()=>{let e;(e=[...t]).splice(i,1),n(e.length>0?e:void 0)}},i))}),(0,l.jsx)(g.A,{variant:"outlined",startIcon:(0,l.jsx)(m.default,{}),sx:{marginTop:1},onClick:()=>{let e=[...t];e.push({condition:{kind:"Value",spec:{value:""}}}),n(e)},children:i})]})}function b(e){let{cellSettings:t,onChange:n}=e;return(0,l.jsx)(C,{cellSettings:t,onChange:e=>n(e||[])})}var A=n(68003),k=n(12138),y=n(21147),S=n(42524);let E=e=>{let{onChange:t,column:n,column:{dataLink:i}}=e;if(!i)return(0,l.jsxs)(a.A,{sx:{width:"100%",alignItems:"center"},direction:"row",children:[(0,l.jsx)(d.A,{flex:1,variant:"subtitle1",mb:2,fontStyle:"italic",children:"No link defined"}),(0,l.jsx)(u.A,{style:{width:"fit-content",height:"fit-content"},onClick:()=>t({...n,dataLink:{url:"",openNewTab:!0,title:""}}),children:(0,l.jsx)(m.default,{})})]});let{url:o,openNewTab:r,title:s}=i;return(0,l.jsxs)(a.A,{sx:{width:"100%",alignItems:"center"},direction:"row",children:[(0,l.jsx)(f.LinkEditorForm,{mode:"inline",url:{label:"Url",onChange:e=>{t({...n,dataLink:{...i,url:e}})},value:o,placeholder:"URL",error:{hasError:!1,helperText:""}},name:{label:"Name",onChange:e=>{t({...n,dataLink:{...i,title:e}})},value:s??"",placeholder:"Name"},newTabOpen:{label:"Open in new tab",onChange:e=>{t({...n,dataLink:{...i,openNewTab:e}})},value:r}}),(0,l.jsx)(u.A,{style:{width:"fit-content",height:"fit-content"},onClick:()=>{t({...n,dataLink:void 0})},children:(0,l.jsx)(S.default,{})})]})},w={unit:"decimal",shortValues:!0};function O(e){let{column:t,onChange:n,...o}=e,[r,c]=(0,i.useState)(void 0===t.width||"auto"===t.width?100:t.width);return(0,l.jsxs)(a.A,{...o,children:[(0,l.jsxs)(f.OptionsEditorGrid,{children:[(0,l.jsx)(f.OptionsEditorColumn,{children:(0,l.jsxs)(f.OptionsEditorGroup,{title:"Column",children:[(0,l.jsx)(f.OptionsEditorControl,{label:"Name*",control:(0,l.jsx)(s.A,{value:t.name,onChange:e=>n({...t,name:e.target.value}),required:!0})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Header",control:(0,l.jsx)(s.A,{value:t.header??"",onChange:e=>n({...t,header:e.target.value?e.target.value:void 0})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Header Tooltip",control:(0,l.jsx)(s.A,{value:t.headerDescription??"",onChange:e=>n({...t,headerDescription:e.target.value?e.target.value:void 0})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Cell Tooltip",control:(0,l.jsx)(s.A,{value:t.cellDescription??"",onChange:e=>n({...t,cellDescription:e.target.value?e.target.value:void 0})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Enable sorting",control:(0,l.jsx)(A.A,{checked:t.enableSorting??!1,onChange:e=>n({...t,enableSorting:e.target.checked})})}),t.enableSorting&&(0,l.jsx)(f.OptionsEditorControl,{label:"Default Sort",control:(0,l.jsx)(f.SortSelectorButtons,{size:"medium",value:t.sort,sx:{margin:.5},onChange:e=>n({...t,sort:e})})})]})}),(0,l.jsx)(f.OptionsEditorColumn,{children:(0,l.jsxs)(f.OptionsEditorGroup,{title:"Visual",children:[(0,l.jsx)(f.OptionsEditorControl,{label:"Show column",control:(0,l.jsx)(A.A,{checked:!t.hide,onChange:e=>n({...t,hide:!e.target.checked})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Display",control:(0,l.jsxs)(k.A,{"aria-label":"Display",size:"small",children:[(0,l.jsx)(g.A,{variant:t.plugin?"outlined":"contained",onClick:()=>n({...t,plugin:void 0}),children:"Text"}),(0,l.jsx)(g.A,{variant:t.plugin?"contained":"outlined",onClick:()=>n({...t,plugin:{kind:"StatChart",spec:{}}}),children:"Embedded Panel"})]})}),t.plugin?(0,l.jsx)(f.OptionsEditorControl,{label:"Panel Type",control:(0,l.jsx)(y.PluginKindSelect,{pluginTypes:["Panel"],value:{type:"Panel",kind:t.plugin.kind},onChange:e=>n({...t,plugin:{kind:e.kind,spec:{}}})})}):(0,l.jsx)(f.FormatControls,{value:t.format??w,onChange:e=>n({...t,format:e})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Alignment",control:(0,l.jsx)(f.AlignSelector,{size:"small",value:t.align??"left",onChange:e=>n({...t,align:e})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Custom width",control:(0,l.jsx)(A.A,{checked:void 0!==t.width&&"auto"!==t.width,onChange:e=>n({...t,width:e.target.checked?r:"auto"})})}),void 0!==t.width&&"auto"!==t.width&&(0,l.jsx)(f.OptionsEditorControl,{label:"Width",control:(0,l.jsx)(s.A,{type:"number",value:r,slotProps:{htmlInput:{min:1}},onChange:e=>{c(+e.target.value),n({...t,width:+e.target.value})}})})]})}),(0,l.jsx)(f.OptionsEditorColumn,{children:(0,l.jsx)(f.OptionsEditorGroup,{title:"Link",children:(0,l.jsx)(E,{column:t,onChange:n})})})]}),(0,l.jsx)(a.A,{sx:{px:8},children:(0,l.jsx)(f.OptionsEditorGroup,{title:"Conditional Cell Format",children:(0,l.jsx)(C,{cellSettings:t.cellSettings,onChange:e=>n({...t,cellSettings:e})})})})]})}var M=n(11061),T=n(87275),z=n(1355),D=n(78536);function N(e){let{column:t,isCollapsed:n,onChange:i,onCollapse:o,onDelete:r,onMoveUp:s,onMoveDown:c}=e;return(0,l.jsxs)(f.DragAndDropElement,{data:t,children:[(0,l.jsxs)(a.A,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,justifyContent:"space-between",gap:4,children:[(0,l.jsxs)(a.A,{direction:"row",gap:1,children:[(0,l.jsx)(u.A,{"data-testid":`column-toggle#${t.name}`,size:"small",onClick:()=>o(!n),children:n?(0,l.jsx)(M.default,{}):(0,l.jsx)(T.default,{})}),(0,l.jsxs)(d.A,{variant:"overline",component:"h4",sx:{textTransform:"none"},children:["COLUMN:"," ",t.header?(0,l.jsxs)("span",{children:[(0,l.jsx)("strong",{children:t.header})," (",t.name,")"]}):(0,l.jsx)("strong",{children:t.name})]})]}),(0,l.jsxs)(a.A,{direction:"row",gap:1,children:[n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(h.A,{title:t.hide?"Show column":"Hide column",placement:"top",children:(0,l.jsx)(u.A,{size:"small",sx:{marginLeft:"auto"},onClick:function(){i({...t,hide:!t.hide})},children:t.hide?(0,l.jsx)(D.default,{}):(0,l.jsx)(z.default,{})},"hide-column")}),(0,l.jsx)(p.A,{flexItem:!0,orientation:"vertical",variant:"middle"})]}),(0,l.jsx)(h.A,{title:"Remove column settings",placement:"top",children:(0,l.jsx)(u.A,{size:"small",sx:{marginLeft:"auto"},onClick:r,children:(0,l.jsx)(x.default,{})},"delete-column-button")}),(0,l.jsx)(h.A,{title:"Reorder column settings",placement:"top",children:(0,l.jsx)(f.DragButton,{onMoveUp:s,onMoveDown:c,menuSx:{".MuiPaper-root":{backgroundColor:e=>e.palette.background.lighter}}},"reorder-column-button")})]})]}),!n&&(0,l.jsx)("div",{children:(0,l.jsx)(O,{column:t,onChange:i})})]})}function R(e){let{columnSettings:t,onChange:n}=e,[o,r]=(0,i.useState)(t.map(()=>!0));return(0,f.useDragAndDropMonitor)({elements:t,accessKey:"name",onChange:n}),(0,l.jsxs)(a.A,{spacing:1,children:[t.map((e,i)=>(0,l.jsx)(N,{column:e,isCollapsed:o[i]??!0,onChange:e=>{let l;(l=[...t])[i]=e,n(l)},onDelete:()=>{let e;(e=[...t]).splice(i,1),n(e),r(e=>(e.splice(i,1),[...e]))},onCollapse:e=>{r(t=>(t[i]=e,[...t]))},onMoveUp:()=>n((0,f.handleMoveUp)(e,t)),onMoveDown:()=>n((0,f.handleMoveDown)(e,t))},i)),(0,l.jsx)(g.A,{variant:"contained",startIcon:(0,l.jsx)(m.default,{}),sx:{marginTop:1},onClick:function(){let e=`column_${Object.keys(t).length}`,l=[...t];l.push({name:e}),n(l),r(e=>(e.push(!1),[...e]))},children:"Add Column Settings"})]})}var I=n(33061),$=n(85180);function L(e){let{kind:t,spec:n,queryResults:i}=e,{ref:o,width:r=1,height:a=1}=(0,$.default)();return(0,l.jsx)("div",{ref:o,style:{height:"100%"},children:(0,l.jsx)(f.ErrorBoundary,{FallbackComponent:f.ErrorAlert,children:(0,l.jsx)(I.PanelPluginLoader,{kind:t,contentDimensions:{width:r,height:a},spec:n,queryResults:i})})})}var F=n(56599),V=n(74628),W=n(54739);function P(e){let{allValues:t,selectedValues:n,onFilterChange:i,theme:o}=e,r=[...new Set(t)].filter(e=>null!=e).sort();return 0===r.length?(0,l.jsx)("div",{"data-filter-dropdown":!0,style:{width:200,padding:10,backgroundColor:o.palette.background.paper,border:`1px solid ${o.palette.divider}`,borderRadius:4,boxShadow:o.shadows[4]},children:(0,l.jsx)("div",{style:{color:o.palette.text.secondary,fontSize:14},children:"No values found"})}):(0,l.jsxs)("div",{"data-filter-dropdown":!0,style:{width:200,padding:10,backgroundColor:o.palette.background.paper,border:`1px solid ${o.palette.divider}`,borderRadius:4,boxShadow:o.shadows[4],maxHeight:250,overflowY:"auto"},children:[(0,l.jsx)("div",{style:{marginBottom:8,fontSize:14,fontWeight:"bold"},children:(0,l.jsxs)("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[(0,l.jsx)("input",{type:"checkbox",checked:n.length===r.length&&r.length>0,onChange:e=>i(e.target.checked?r:[]),style:{marginRight:8}}),(0,l.jsxs)("span",{style:{color:o.palette.text.primary},children:["Select All (",r.length,")"]})]})}),(0,l.jsx)("hr",{style:{margin:"8px 0",border:"none",borderTop:`1px solid ${o.palette.divider}`}}),r.map((e,t)=>(0,l.jsx)("div",{style:{marginBottom:4},children:(0,l.jsxs)("label",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 0",borderRadius:2},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=o.palette.action.hover},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[(0,l.jsx)("input",{type:"checkbox",checked:n.includes(e),onChange:t=>{t.target.checked?i([...n,e]):i(n.filter(t=>t!==e))},style:{marginRight:8}}),(0,l.jsx)("span",{style:{fontSize:14,color:o.palette.text.primary},children:null==e||""===e?"(empty)":String(e)})]})},`value-${t}`))]})}function H(e,t,n){for(let i of t)if(i.name===e){if(i.hide)return;let{name:e,header:t,headerDescription:o,enableSorting:r,width:a,align:s,dataLink:c}=i;return{accessorKey:e,header:t??e,headerDescription:o,enableSorting:r,width:a,align:s,dataLink:c?{...c,url:(0,y.replaceVariablesInString)(c.url,n)}:void 0,...function(e){let t=e.plugin;return void 0!==t?{cell:e=>{let n=e.getValue();return n?(0,l.jsx)(L,{kind:t.kind,spec:t.spec,queryResults:[n]}):(0,l.jsx)(l.Fragment,{})},cellDescription:e.cellDescription?()=>`${e.cellDescription}`:()=>""}:{cell:t=>{let n=t.getValue();return"number"==typeof n&&e.format?(0,W.formatValue)(n,e.format):n},cellDescription:e.cellDescription?()=>`${e.cellDescription}`:void 0}}(i)}}return{accessorKey:e,header:e}}function U(e){return{mode:(e.columnSettings??[]).some(e=>e.plugin)?"range":"instant"}}function B(e){let{label:t,defaultValue:n,value:i,onChange:o}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f.OptionsEditorControl,{label:`Auto Columns ${t}`,control:(0,l.jsx)(A.A,{checked:void 0===i||"auto"===i,onChange:function(e,t){if(t)return o("auto");o(n)}})}),void 0!==i&&"auto"!==i&&(0,l.jsx)(f.OptionsEditorControl,{label:`Default Columns ${t}`,control:(0,l.jsx)(s.A,{type:"number",value:i??n,slotProps:{input:{inputProps:{min:1,step:1}}},onChange:e=>o(parseInt(e.target.value))})})]})}let G={PanelComponent:function(e){var t,n;let{contentDimensions:o,spec:r,queryResults:a}=e,s=(0,F.A)(),c=(0,y.useAllVariableValues)(),u=(null==(t=r.selection)?void 0:t.enabled)??!1,{selectionMap:h,setSelection:p,clearSelection:g}=(0,f.useSelection)(),x=r.actions?r.actions:void 0,m=(null==x?void 0:x.enabled)&&x.displayWithItem?x.actionsList:[],{getItemActionButtons:j,confirmDialog:C,actionButtons:b}=(0,I.useSelectionItemActions)({actions:m,variableState:c}),A=(0,i.useRef)([]),k=(0,i.useMemo)(()=>{let e={};return h.forEach((t,n)=>{e[n]=!0}),e},[h]),S=(0,i.useCallback)(e=>{let t=[];for(let[n,l]of Object.entries(e))if(l){let e=parseInt(n,10);void 0!==A.current[e]&&t.push({id:n,item:A.current[e]})}0===t.length?g():p(t)},[p,g]),E=U(r).mode,w=(0,i.useMemo)(()=>a.flatMap((e,t)=>e.data.series.map(n=>({data:e,ts:n,queryIndex:t}))).map(e=>{var t;let{data:n,ts:l,queryIndex:i}=e;if(void 0===l.values[0])return{...l.labels};let o=1===a.length?"value":`value #${i+1}`,s=1===a.length?l.labels:Object.entries(l.labels??{}).reduce((e,t)=>{let[n,l]=t;return n&&(e[`${n} #${i+1}`]=l),e},{}),c=(null==(t=(r.columnSettings??[]).find(e=>e.name===o))?void 0:t.plugin)?{...n,data:{...n.data,series:n.data.series.filter(e=>e===l)}}:l.values[0][1];return"instant"===E?{timestamp:l.values[0][0],[o]:c,...s}:{[o]:c,...s}}),[a,E,r.columnSettings]),O=(0,i.useMemo)(()=>(0,W.transformData)(w,r.transforms??[]),[w,r.transforms]),M=(0,i.useMemo)(()=>{let e=[];for(let t of O)for(let n of Object.keys(t))e.includes(n)||e.push(n);return e},[O]),T=(0,i.useMemo)(()=>{let e={};return M.forEach(t=>{let n=O.map(e=>e[t]).filter(e=>null!=e&&""!==e);e[t]=Array.from(new Set(n))}),e},[O,M]),z=(0,i.useMemo)(()=>{let e=[],t=new Set;for(let n of r.columnSettings??[]){if(t.has(n.name))continue;let l=H(n.name,r.columnSettings??[],c);void 0!==l&&(e.push(l),t.add(n.name))}if(!r.defaultColumnHidden){for(let n of M)if(!t.has(n)){let t=H(n,r.columnSettings??[],c);void 0!==t&&e.push(t)}}return e},[M,r.columnSettings,r.defaultColumnHidden,c]),D=(0,i.useMemo)(()=>{var e,t,n;if(void 0===r.cellSettings&&!(null==(e=r.columnSettings)?void 0:e.some(e=>void 0!==e.cellSettings)))return{};let l={},i=0;for(let e of O){for(let[o,a]of Object.entries({...M.reduce((e,t)=>(e[t]=void 0,e),{}),...e})){let e=v(a,r.cellSettings??[]),s=null==(t=r.columnSettings)?void 0:t.find(e=>e.name===o);if(null==s||null==(n=s.cellSettings)?void 0:n.length){let t=v(a,s.cellSettings);t&&(e=t)}e&&(l[`${i}_${o}`]=e)}i++}return l},[O,M,r.cellSettings,r.columnSettings]),[N,R]=(0,i.useState)((null==(n=r.columnSettings)?void 0:n.filter(e=>void 0!==e.sort).map(e=>({id:e.name,desc:"desc"===e.sort})))??[]),[$,L]=(0,i.useState)([]),[B,G]=(0,i.useState)({}),[K,_]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!K)return;let e=e=>{let t=e.target;t.closest("[data-filter-dropdown]")||t.closest("button")||(G({}),_(null))},t=setTimeout(()=>{document.addEventListener("click",e)},100);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[K]);let q=(0,i.useMemo)(()=>{let e=[...O];return r.enableFiltering&&$.length>0&&(e=e.filter(e=>$.every(t=>{let n=e[t.id],l=t.value;return!l||0===l.length||l.includes(n)}))),e},[O,$,r.enableFiltering]);A.current=q;let[Q,J]=(0,i.useState)(r.pagination?{pageIndex:0,pageSize:10}:void 0);return((0,i.useEffect)(()=>{r.pagination&&!Q?J({pageIndex:0,pageSize:10}):!r.pagination&&Q&&J(void 0)},[r.pagination,Q]),void 0===o)?null:(null==O?void 0:O.length)?(0,l.jsxs)(l.Fragment,{children:[C,r.enableFiltering&&(0,l.jsx)("div",{style:{display:"flex",background:s.palette.background.default,borderBottom:`1px solid ${s.palette.divider}`,width:o.width,boxSizing:"border-box"},children:z.map((e,t)=>{var n;let i,o=(n=e.accessorKey,(i=$.find(e=>e.id===n))?i.value:[]),a=e.width||r.defaultColumnWidth;return(0,l.jsxs)("div",{style:{padding:"8px",borderRight:t<z.length-1?`1px solid ${s.palette.divider}`:"none",width:a,minWidth:a,maxWidth:a,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",flex:"number"==typeof a?"none":"1 1 auto"},children:[(0,l.jsx)("span",{style:{marginRight:8,fontSize:"12px",color:s.palette.text.secondary,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.length?`${o.length} items`:"All"}),(0,l.jsx)("button",{onClick:t=>{var n;n=e.accessorKey,t.preventDefault(),t.stopPropagation(),G({...B,[n]:t.currentTarget}),_(n)},style:{border:`1px solid ${s.palette.divider}`,background:s.palette.background.paper,cursor:"pointer",fontSize:"12px",color:o.length?s.palette.primary.main:s.palette.text.secondary,padding:"4px 8px",borderRadius:"4px",minWidth:"20px",height:"24px",flexShrink:0,transition:"all 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.background=s.palette.action.hover},onMouseLeave:e=>{e.currentTarget.style.background=s.palette.background.paper},type:"button",children:"▼"}),K===e.accessorKey&&(0,l.jsx)("div",{style:{position:"absolute",top:"100%",left:0,zIndex:1e3,marginTop:4},children:(0,l.jsx)(P,{allValues:T[e.accessorKey]||[],selectedValues:o,onFilterChange:t=>{var n;let l;return n=e.accessorKey,l=$.filter(e=>e.id!==n),void(t.length>0&&l.push({id:n,value:t}),L(l))},theme:s})})]},`filter-${t}`)})}),(0,l.jsx)(f.Table,{data:q,columns:z,cellConfigs:D,height:r.enableFiltering?o.height-40:o.height,width:o.width,density:r.density,defaultColumnWidth:r.defaultColumnWidth,defaultColumnHeight:r.defaultColumnHeight,sorting:N,onSortingChange:R,pagination:Q,onPaginationChange:J,checkboxSelection:u,rowSelection:k,onRowSelectionChange:S,getItemActions:e=>{let{id:t,data:n}=e;return j({id:t,data:n})},hasItemActions:b&&b.length>0})]}):(0,l.jsx)(V.A,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,l.jsx)(d.A,{children:"No data"})})},supportedQueryTypes:["TimeSeriesQuery"],queryOptions:U,panelOptionsEditorComponents:[{label:"General Settings",content:function(e){let{onChange:t,value:n}=e;return(0,l.jsx)(f.OptionsEditorGrid,{children:(0,l.jsx)(f.OptionsEditorColumn,{children:(0,l.jsxs)(f.OptionsEditorGroup,{title:"Display",children:[(0,l.jsx)(f.DensitySelector,{value:n.density,onChange:function(e){t({...n,density:e})}}),(0,l.jsx)(f.OptionsEditorControl,{label:"Pagination",control:(0,l.jsx)(A.A,{checked:!!n.pagination,onChange:function(e,l){t({...n,pagination:l})}})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Columns Hidden by Default",control:(0,l.jsx)(A.A,{checked:!!n.defaultColumnHidden,onChange:function(e,l){t({...n,defaultColumnHidden:l})}})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Enable Column Filtering",control:(0,l.jsx)(A.A,{checked:!!n.enableFiltering,onChange:function(e,l){t({...n,enableFiltering:l})}})}),(0,l.jsx)(B,{label:"Width",defaultValue:f.DEFAULT_COLUMN_WIDTH,value:n.defaultColumnWidth,onChange:function(e){t({...n,defaultColumnWidth:e})}}),(0,l.jsx)(B,{label:"Height",defaultValue:f.DEFAULT_COLUMN_HEIGHT,value:n.defaultColumnHeight,onChange:function(e){t({...n,defaultColumnHeight:e})}})]})})})}},{label:"Column Settings",content:function(e){let{onChange:t,value:n}=e;return(0,l.jsx)(R,{columnSettings:n.columnSettings??[],onChange:function(e){t({...n,columnSettings:e})}})}},{label:"Cell Settings",content:function(e){let{onChange:t,value:n}=e;return(0,l.jsx)(b,{cellSettings:n.cellSettings??[],onChange:function(e){t({...n,cellSettings:e})}})}},{label:"Transforms",content:function(e){let{value:t,onChange:n}=e;return(0,l.jsx)(f.TransformsEditor,{value:t.transforms??[],onChange:function(e){n({...t,transforms:e})}})}},{label:"Item Actions",content:function(e){let{value:t,onChange:n}=e;return(0,l.jsx)(y.ItemSelectionActionsEditor,{actionOptions:t.actions,onChangeActions:function(e){n({...t,actions:e})},selectionOptions:t.selection,onChangeSelection:function(e){n({...t,selection:e})}})}}],createInitialOptions:function(){return{density:"standard",enableFiltering:!0}}}}}]);
|
|
1
|
+
"use strict";(self.chunk_Table=self.chunk_Table||[]).push([["2669"],{80881:function(e,t,n){n.r(t),n.d(t,{Table:()=>G});var l=n(62540),i=n(70451),o=n.n(i),r=n(54381),a=n(315),s=n(93648),c=n(97653),d=n(88091),u=n(47095),h=n(65211),p=n(6227),g=n(7013),x=n(86067),m=n(86742),f=n(43349);function v(e,t){for(let l of t)if(function(e,t){var n,l,i,o,r,a,s;switch(e.kind){case"Value":return(null==(n=e.spec)?void 0:n.value)===String(t);case"Range":{if(Number.isNaN(Number(t)))return!1;let n=Number(t);if((null==(l=e.spec)?void 0:l.min)!==void 0&&(null==(i=e.spec)?void 0:i.max)!==void 0)return n>=+e.spec.min&&n<=+e.spec.max;if((null==(o=e.spec)?void 0:o.min)!==void 0)return n>=+e.spec.min;if((null==(r=e.spec)?void 0:r.max)!==void 0)return n<=+e.spec.max;return!1}case"Regex":if(!(null==(a=e.spec)?void 0:a.expr))return!1;try{return new RegExp(e.spec.expr).test(String(t))}catch{return!1}case"Misc":switch(null==(s=e.spec)?void 0:s.value){case"empty":return""===t;case"null":return null==t;case"NaN":return Number.isNaN(t);case"true":return!0===t;case"false":return!1===t;default:return!1}default:return!1}}(l.condition,e)){let t;if("Misc"===l.condition.kind){var n;switch(null==(n=l.condition.spec)?void 0:n.value){case"null":t="null";break;case"NaN":t="NaN"}}return function(e,t,n){let l=t.text||n||String(e);return{text:`${t.prefix??""}${l}${t.suffix??""}`,textColor:t.textColor,backgroundColor:t.backgroundColor}}(e,l,t)}}function j(e){let{cell:t,onChange:n,onDelete:i,...p}=e;return(0,l.jsxs)(r.A,{container:!0,spacing:2,...p,children:[(0,l.jsx)(r.A,{size:{xs:5},children:(0,l.jsxs)(a.A,{direction:"row",gap:1,width:"100%",children:[(0,l.jsxs)(s.A,{select:!0,label:"Type",value:t.condition.kind,onChange:e=>n({...t,condition:{kind:e.target.value}}),required:!0,sx:{width:"120px"},children:[(0,l.jsx)(c.A,{value:"Value",children:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.A,{children:"Value"}),"Value"!==t.condition.kind&&(0,l.jsx)(d.A,{variant:"caption",children:"Matches an exact text value"})]})}),(0,l.jsx)(c.A,{value:"Range",children:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.A,{children:"Range"}),"Range"!==t.condition.kind&&(0,l.jsx)(d.A,{variant:"caption",children:"Matches against a numerical range"})]})}),(0,l.jsx)(c.A,{value:"Regex",children:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.A,{children:"Regex"}),"Regex"!==t.condition.kind&&(0,l.jsx)(d.A,{variant:"caption",children:"Matches against a regular expression"})]})}),(0,l.jsx)(c.A,{value:"Misc",children:(0,l.jsxs)(a.A,{children:[(0,l.jsx)(d.A,{children:"Misc"}),"Misc"!==t.condition.kind&&(0,l.jsx)(d.A,{variant:"caption",children:"Matches against empty, null and NaN values"})]})})]}),function(e,t){var n,l,i,r,u;let h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"small";return"Value"===e.kind?o().createElement(s.A,{label:"Value",placeholder:"Exact value",value:(null==(n=e.spec)?void 0:n.value)??"",onChange:n=>t({...e,spec:{value:n.target.value}}),fullWidth:!0,size:h}):"Range"===e.kind?o().createElement(a.A,{gap:1,direction:"row"},[o().createElement(s.A,{key:"min",label:"From",placeholder:"Start of range",value:(null==(l=e.spec)?void 0:l.min)??"",onChange:n=>t({...e,spec:{...e.spec,min:+n.target.value}}),fullWidth:!0,size:h}),o().createElement(s.A,{key:"max",label:"To",placeholder:"End of range (inclusive)",value:(null==(i=e.spec)?void 0:i.max)??"",onChange:n=>t({...e,spec:{...e.spec,max:+n.target.value}}),fullWidth:!0,size:h})]):"Regex"===e.kind?o().createElement(s.A,{label:"Regular Expression",placeholder:"JavaScript regular expression",value:(null==(r=e.spec)?void 0:r.expr)??"",onChange:n=>t({...e,spec:{expr:n.target.value}}),fullWidth:!0,size:h}):"Misc"===e.kind?o().createElement(s.A,{select:!0,label:"Value",value:(null==(u=e.spec)?void 0:u.value)??"",onChange:n=>t({...e,spec:{value:n.target.value}}),fullWidth:!0,size:h},[{value:"empty",label:"Empty",caption:"Matches empty string"},{value:"null",label:"Null",caption:"Matches null or undefined"},{value:"NaN",label:"NaN",caption:"Matches Not a Number value"},{value:"true",label:"True",caption:"Matches true boolean"},{value:"false",label:"False",caption:"Matches false boolean"}].map(e=>o().createElement(c.A,{key:e.value,value:e.value},o().createElement(a.A,{key:"stack"},[o().createElement(d.A,{key:"title"},e.label),o().createElement(d.A,{key:"caption",variant:"caption"},e.caption)])))):null}(t.condition,e=>n({...t,condition:e}),"small")]})}),(0,l.jsx)(r.A,{size:{xs:4},children:(0,l.jsxs)(a.A,{spacing:1,children:[(0,l.jsx)(s.A,{label:"Display text",value:t.text,onChange:e=>n({...t,text:e.target.value}),fullWidth:!0,size:"small"}),(0,l.jsxs)(a.A,{direction:"row",spacing:1,children:[(0,l.jsx)(s.A,{label:"Prefix",placeholder:"$",value:t.prefix??"",onChange:e=>n({...t,prefix:e.target.value}),size:"small"}),(0,l.jsx)(s.A,{label:"Suffix",placeholder:"%",value:t.suffix??"",onChange:e=>n({...t,suffix:e.target.value}),size:"small"})]})]})}),(0,l.jsx)(r.A,{size:{xs:1},children:(0,l.jsx)(a.A,{direction:"row",justifyContent:"center",gap:1,children:t.textColor?(0,l.jsx)(f.OptionsColorPicker,{label:"Text Color",color:t.textColor??"#000",onColorChange:e=>n({...t,textColor:e}),onClear:()=>n({...t,textColor:void 0})}):(0,l.jsx)(u.A,{onClick:()=>n({...t,textColor:"#000"}),children:(0,l.jsx)(m.default,{})})})}),(0,l.jsx)(r.A,{size:{xs:1},children:(0,l.jsx)(a.A,{direction:"row",justifyContent:"center",children:t.backgroundColor?(0,l.jsx)(f.OptionsColorPicker,{label:"Background Color",color:t.backgroundColor??"#fff",onColorChange:e=>n({...t,backgroundColor:e}),onClear:()=>n({...t,backgroundColor:void 0})}):(0,l.jsx)(u.A,{onClick:()=>n({...t,backgroundColor:"#000"}),children:(0,l.jsx)(m.default,{})})})}),(0,l.jsx)(r.A,{size:{xs:1},textAlign:"end",children:(0,l.jsx)(h.A,{title:"Remove cell settings",placement:"top",children:(0,l.jsx)(u.A,{size:"small",sx:{marginLeft:"auto"},onClick:i,children:(0,l.jsx)(x.default,{})},"delete-cell-button")})})]})}function C(e){let{cellSettings:t=[],onChange:n,addButtonText:i="Add Conditional Format"}=e;return(0,l.jsxs)(a.A,{spacing:3,sx:{mt:2},children:[(0,l.jsxs)(r.A,{container:!0,spacing:3,children:[(0,l.jsx)(r.A,{size:{xs:5},children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Condition"})}),(0,l.jsx)(r.A,{size:{xs:4},children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Display Text"})}),(0,l.jsx)(r.A,{size:{xs:1},textAlign:"center",children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Color"})}),(0,l.jsx)(r.A,{size:{xs:1},textAlign:"center",children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Background"})}),(0,l.jsx)(r.A,{size:{xs:1}})]}),(0,l.jsx)(a.A,{gap:1.5,divider:(0,l.jsx)(p.A,{flexItem:!0,orientation:"horizontal"}),children:t.map((e,i)=>(0,l.jsx)(j,{cell:e,onChange:e=>{let l;(l=[...t])[i]=e,n(l)},onDelete:()=>{let e;(e=[...t]).splice(i,1),n(e.length>0?e:void 0)}},i))}),(0,l.jsx)(g.A,{variant:"outlined",startIcon:(0,l.jsx)(m.default,{}),sx:{marginTop:1},onClick:()=>{let e=[...t];e.push({condition:{kind:"Value",spec:{value:""}}}),n(e)},children:i})]})}function b(e){let{cellSettings:t,onChange:n}=e;return(0,l.jsx)(C,{cellSettings:t,onChange:e=>n(e||[])})}var A=n(68003),k=n(12138),y=n(36603),S=n(42524);let E=e=>{let{onChange:t,column:n,column:{dataLink:i}}=e;if(!i)return(0,l.jsxs)(a.A,{sx:{width:"100%",alignItems:"center"},direction:"row",children:[(0,l.jsx)(d.A,{flex:1,variant:"subtitle1",mb:2,fontStyle:"italic",children:"No link defined"}),(0,l.jsx)(u.A,{style:{width:"fit-content",height:"fit-content"},onClick:()=>t({...n,dataLink:{url:"",openNewTab:!0,title:""}}),children:(0,l.jsx)(m.default,{})})]});let{url:o,openNewTab:r,title:s}=i;return(0,l.jsxs)(a.A,{sx:{width:"100%",alignItems:"center"},direction:"row",children:[(0,l.jsx)(f.LinkEditorForm,{mode:"inline",url:{label:"Url",onChange:e=>{t({...n,dataLink:{...i,url:e}})},value:o,placeholder:"URL",error:{hasError:!1,helperText:""}},name:{label:"Name",onChange:e=>{t({...n,dataLink:{...i,title:e}})},value:s??"",placeholder:"Name"},newTabOpen:{label:"Open in new tab",onChange:e=>{t({...n,dataLink:{...i,openNewTab:e}})},value:r}}),(0,l.jsx)(u.A,{style:{width:"fit-content",height:"fit-content"},onClick:()=>{t({...n,dataLink:void 0})},children:(0,l.jsx)(S.default,{})})]})},w={unit:"decimal",shortValues:!0};function O(e){let{column:t,onChange:n,...o}=e,[r,c]=(0,i.useState)(void 0===t.width||"auto"===t.width?100:t.width);return(0,l.jsxs)(a.A,{...o,children:[(0,l.jsxs)(f.OptionsEditorGrid,{children:[(0,l.jsx)(f.OptionsEditorColumn,{children:(0,l.jsxs)(f.OptionsEditorGroup,{title:"Column",children:[(0,l.jsx)(f.OptionsEditorControl,{label:"Name*",control:(0,l.jsx)(s.A,{value:t.name,onChange:e=>n({...t,name:e.target.value}),required:!0})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Header",control:(0,l.jsx)(s.A,{value:t.header??"",onChange:e=>n({...t,header:e.target.value?e.target.value:void 0})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Header Tooltip",control:(0,l.jsx)(s.A,{value:t.headerDescription??"",onChange:e=>n({...t,headerDescription:e.target.value?e.target.value:void 0})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Cell Tooltip",control:(0,l.jsx)(s.A,{value:t.cellDescription??"",onChange:e=>n({...t,cellDescription:e.target.value?e.target.value:void 0})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Enable sorting",control:(0,l.jsx)(A.A,{checked:t.enableSorting??!1,onChange:e=>n({...t,enableSorting:e.target.checked})})}),t.enableSorting&&(0,l.jsx)(f.OptionsEditorControl,{label:"Default Sort",control:(0,l.jsx)(f.SortSelectorButtons,{size:"medium",value:t.sort,sx:{margin:.5},onChange:e=>n({...t,sort:e})})})]})}),(0,l.jsx)(f.OptionsEditorColumn,{children:(0,l.jsxs)(f.OptionsEditorGroup,{title:"Visual",children:[(0,l.jsx)(f.OptionsEditorControl,{label:"Show column",control:(0,l.jsx)(A.A,{checked:!t.hide,onChange:e=>n({...t,hide:!e.target.checked})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Display",control:(0,l.jsxs)(k.A,{"aria-label":"Display",size:"small",children:[(0,l.jsx)(g.A,{variant:t.plugin?"outlined":"contained",onClick:()=>n({...t,plugin:void 0}),children:"Text"}),(0,l.jsx)(g.A,{variant:t.plugin?"contained":"outlined",onClick:()=>n({...t,plugin:{kind:"StatChart",spec:{}}}),children:"Embedded Panel"})]})}),t.plugin?(0,l.jsx)(f.OptionsEditorControl,{label:"Panel Type",control:(0,l.jsx)(y.PluginKindSelect,{pluginTypes:["Panel"],value:{type:"Panel",kind:t.plugin.kind},onChange:e=>n({...t,plugin:{kind:e.kind,spec:{}}})})}):(0,l.jsx)(f.FormatControls,{value:t.format??w,onChange:e=>n({...t,format:e})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Alignment",control:(0,l.jsx)(f.AlignSelector,{size:"small",value:t.align??"left",onChange:e=>n({...t,align:e})})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Custom width",control:(0,l.jsx)(A.A,{checked:void 0!==t.width&&"auto"!==t.width,onChange:e=>n({...t,width:e.target.checked?r:"auto"})})}),void 0!==t.width&&"auto"!==t.width&&(0,l.jsx)(f.OptionsEditorControl,{label:"Width",control:(0,l.jsx)(s.A,{type:"number",value:r,slotProps:{htmlInput:{min:1}},onChange:e=>{c(+e.target.value),n({...t,width:+e.target.value})}})})]})}),(0,l.jsx)(f.OptionsEditorColumn,{children:(0,l.jsx)(f.OptionsEditorGroup,{title:"Link",children:(0,l.jsx)(E,{column:t,onChange:n})})})]}),(0,l.jsx)(a.A,{sx:{px:8},children:(0,l.jsx)(f.OptionsEditorGroup,{title:"Conditional Cell Format",children:(0,l.jsx)(C,{cellSettings:t.cellSettings,onChange:e=>n({...t,cellSettings:e})})})})]})}var M=n(11061),T=n(87275),z=n(1355),D=n(78536);function N(e){let{column:t,isCollapsed:n,onChange:i,onCollapse:o,onDelete:r,onMoveUp:s,onMoveDown:c}=e;return(0,l.jsxs)(f.DragAndDropElement,{data:t,children:[(0,l.jsxs)(a.A,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,justifyContent:"space-between",gap:4,children:[(0,l.jsxs)(a.A,{direction:"row",gap:1,children:[(0,l.jsx)(u.A,{"data-testid":`column-toggle#${t.name}`,size:"small",onClick:()=>o(!n),children:n?(0,l.jsx)(M.default,{}):(0,l.jsx)(T.default,{})}),(0,l.jsxs)(d.A,{variant:"overline",component:"h4",sx:{textTransform:"none"},children:["COLUMN:"," ",t.header?(0,l.jsxs)("span",{children:[(0,l.jsx)("strong",{children:t.header})," (",t.name,")"]}):(0,l.jsx)("strong",{children:t.name})]})]}),(0,l.jsxs)(a.A,{direction:"row",gap:1,children:[n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(h.A,{title:t.hide?"Show column":"Hide column",placement:"top",children:(0,l.jsx)(u.A,{size:"small",sx:{marginLeft:"auto"},onClick:function(){i({...t,hide:!t.hide})},children:t.hide?(0,l.jsx)(D.default,{}):(0,l.jsx)(z.default,{})},"hide-column")}),(0,l.jsx)(p.A,{flexItem:!0,orientation:"vertical",variant:"middle"})]}),(0,l.jsx)(h.A,{title:"Remove column settings",placement:"top",children:(0,l.jsx)(u.A,{size:"small",sx:{marginLeft:"auto"},onClick:r,children:(0,l.jsx)(x.default,{})},"delete-column-button")}),(0,l.jsx)(h.A,{title:"Reorder column settings",placement:"top",children:(0,l.jsx)(f.DragButton,{onMoveUp:s,onMoveDown:c,menuSx:{".MuiPaper-root":{backgroundColor:e=>e.palette.background.lighter}}},"reorder-column-button")})]})]}),!n&&(0,l.jsx)("div",{children:(0,l.jsx)(O,{column:t,onChange:i})})]})}function R(e){let{columnSettings:t,onChange:n}=e,[o,r]=(0,i.useState)(t.map(()=>!0));return(0,f.useDragAndDropMonitor)({elements:t,accessKey:"name",onChange:n}),(0,l.jsxs)(a.A,{spacing:1,children:[t.map((e,i)=>(0,l.jsx)(N,{column:e,isCollapsed:o[i]??!0,onChange:e=>{let l;(l=[...t])[i]=e,n(l)},onDelete:()=>{let e;(e=[...t]).splice(i,1),n(e),r(e=>(e.splice(i,1),[...e]))},onCollapse:e=>{r(t=>(t[i]=e,[...t]))},onMoveUp:()=>n((0,f.handleMoveUp)(e,t)),onMoveDown:()=>n((0,f.handleMoveDown)(e,t))},i)),(0,l.jsx)(g.A,{variant:"contained",startIcon:(0,l.jsx)(m.default,{}),sx:{marginTop:1},onClick:function(){let e=`column_${Object.keys(t).length}`,l=[...t];l.push({name:e}),n(l),r(e=>(e.push(!1),[...e]))},children:"Add Column Settings"})]})}var I=n(19197),$=n(85180);function L(e){let{kind:t,spec:n,queryResults:i}=e,{ref:o,width:r=1,height:a=1}=(0,$.default)();return(0,l.jsx)("div",{ref:o,style:{height:"100%"},children:(0,l.jsx)(f.ErrorBoundary,{FallbackComponent:f.ErrorAlert,children:(0,l.jsx)(I.PanelPluginLoader,{kind:t,contentDimensions:{width:r,height:a},spec:n,queryResults:i})})})}var F=n(56599),V=n(74628),W=n(20261);function P(e){let{allValues:t,selectedValues:n,onFilterChange:i,theme:o}=e,r=[...new Set(t)].filter(e=>null!=e).sort();return 0===r.length?(0,l.jsx)("div",{"data-filter-dropdown":!0,style:{width:200,padding:10,backgroundColor:o.palette.background.paper,border:`1px solid ${o.palette.divider}`,borderRadius:4,boxShadow:o.shadows[4]},children:(0,l.jsx)("div",{style:{color:o.palette.text.secondary,fontSize:14},children:"No values found"})}):(0,l.jsxs)("div",{"data-filter-dropdown":!0,style:{width:200,padding:10,backgroundColor:o.palette.background.paper,border:`1px solid ${o.palette.divider}`,borderRadius:4,boxShadow:o.shadows[4],maxHeight:250,overflowY:"auto"},children:[(0,l.jsx)("div",{style:{marginBottom:8,fontSize:14,fontWeight:"bold"},children:(0,l.jsxs)("label",{style:{display:"flex",alignItems:"center",cursor:"pointer"},children:[(0,l.jsx)("input",{type:"checkbox",checked:n.length===r.length&&r.length>0,onChange:e=>i(e.target.checked?r:[]),style:{marginRight:8}}),(0,l.jsxs)("span",{style:{color:o.palette.text.primary},children:["Select All (",r.length,")"]})]})}),(0,l.jsx)("hr",{style:{margin:"8px 0",border:"none",borderTop:`1px solid ${o.palette.divider}`}}),r.map((e,t)=>(0,l.jsx)("div",{style:{marginBottom:4},children:(0,l.jsxs)("label",{style:{display:"flex",alignItems:"center",cursor:"pointer",padding:"2px 0",borderRadius:2},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=o.palette.action.hover},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[(0,l.jsx)("input",{type:"checkbox",checked:n.includes(e),onChange:t=>{t.target.checked?i([...n,e]):i(n.filter(t=>t!==e))},style:{marginRight:8}}),(0,l.jsx)("span",{style:{fontSize:14,color:o.palette.text.primary},children:null==e||""===e?"(empty)":String(e)})]})},`value-${t}`))]})}function H(e,t,n){for(let i of t)if(i.name===e){if(i.hide)return;let{name:e,header:t,headerDescription:o,enableSorting:r,width:a,align:s,dataLink:c}=i;return{accessorKey:e,header:t??e,headerDescription:o,enableSorting:r,width:a,align:s,dataLink:c?{...c,url:(0,y.replaceVariablesInString)(c.url,n)}:void 0,...function(e){let t=e.plugin;return void 0!==t?{cell:e=>{let n=e.getValue();return n?(0,l.jsx)(L,{kind:t.kind,spec:t.spec,queryResults:[n]}):(0,l.jsx)(l.Fragment,{})},cellDescription:e.cellDescription?()=>`${e.cellDescription}`:()=>""}:{cell:t=>{let n=t.getValue();return"number"==typeof n&&e.format?(0,W.formatValue)(n,e.format):n},cellDescription:e.cellDescription?()=>`${e.cellDescription}`:void 0}}(i)}}return{accessorKey:e,header:e}}function U(e){return{mode:(e.columnSettings??[]).some(e=>e.plugin)?"range":"instant"}}function B(e){let{label:t,defaultValue:n,value:i,onChange:o}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f.OptionsEditorControl,{label:`Auto Columns ${t}`,control:(0,l.jsx)(A.A,{checked:void 0===i||"auto"===i,onChange:function(e,t){if(t)return o("auto");o(n)}})}),void 0!==i&&"auto"!==i&&(0,l.jsx)(f.OptionsEditorControl,{label:`Default Columns ${t}`,control:(0,l.jsx)(s.A,{type:"number",value:i??n,slotProps:{input:{inputProps:{min:1,step:1}}},onChange:e=>o(parseInt(e.target.value))})})]})}let G={PanelComponent:function(e){var t,n;let{contentDimensions:o,spec:r,queryResults:a}=e,s=(0,F.A)(),c=(0,y.useAllVariableValues)(),u=(null==(t=r.selection)?void 0:t.enabled)??!1,{selectionMap:h,setSelection:p,clearSelection:g}=(0,f.useSelection)(),x=r.actions?r.actions:void 0,m=(null==x?void 0:x.enabled)&&x.displayWithItem?x.actionsList:[],{getItemActionButtons:j,confirmDialog:C,actionButtons:b}=(0,I.useSelectionItemActions)({actions:m,variableState:c}),A=(0,i.useRef)([]),k=(0,i.useMemo)(()=>{let e={};return h.forEach((t,n)=>{e[n]=!0}),e},[h]),S=(0,i.useCallback)(e=>{let t=[];for(let[n,l]of Object.entries(e))if(l){let e=parseInt(n,10);void 0!==A.current[e]&&t.push({id:n,item:A.current[e]})}0===t.length?g():p(t)},[p,g]),E=U(r).mode,w=(0,i.useMemo)(()=>a.flatMap((e,t)=>e.data.series.map(n=>({data:e,ts:n,queryIndex:t}))).map(e=>{var t;let{data:n,ts:l,queryIndex:i}=e;if(void 0===l.values[0])return{...l.labels};let o=1===a.length?"value":`value #${i+1}`,s=1===a.length?l.labels:Object.entries(l.labels??{}).reduce((e,t)=>{let[n,l]=t;return n&&(e[`${n} #${i+1}`]=l),e},{}),c=(null==(t=(r.columnSettings??[]).find(e=>e.name===o))?void 0:t.plugin)?{...n,data:{...n.data,series:n.data.series.filter(e=>e===l)}}:l.values[0][1];return"instant"===E?{timestamp:l.values[0][0],[o]:c,...s}:{[o]:c,...s}}),[a,E,r.columnSettings]),O=(0,i.useMemo)(()=>(0,W.transformData)(w,r.transforms??[]),[w,r.transforms]),M=(0,i.useMemo)(()=>{let e=[];for(let t of O)for(let n of Object.keys(t))e.includes(n)||e.push(n);return e},[O]),T=(0,i.useMemo)(()=>{let e={};return M.forEach(t=>{let n=O.map(e=>e[t]).filter(e=>null!=e&&""!==e);e[t]=Array.from(new Set(n))}),e},[O,M]),z=(0,i.useMemo)(()=>{let e=[],t=new Set;for(let n of r.columnSettings??[]){if(t.has(n.name))continue;let l=H(n.name,r.columnSettings??[],c);void 0!==l&&(e.push(l),t.add(n.name))}if(!r.defaultColumnHidden){for(let n of M)if(!t.has(n)){let t=H(n,r.columnSettings??[],c);void 0!==t&&e.push(t)}}return e},[M,r.columnSettings,r.defaultColumnHidden,c]),D=(0,i.useMemo)(()=>{var e,t,n;if(void 0===r.cellSettings&&!(null==(e=r.columnSettings)?void 0:e.some(e=>void 0!==e.cellSettings)))return{};let l={},i=0;for(let e of O){for(let[o,a]of Object.entries({...M.reduce((e,t)=>(e[t]=void 0,e),{}),...e})){let e=v(a,r.cellSettings??[]),s=null==(t=r.columnSettings)?void 0:t.find(e=>e.name===o);if(null==s||null==(n=s.cellSettings)?void 0:n.length){let t=v(a,s.cellSettings);t&&(e=t)}e&&(l[`${i}_${o}`]=e)}i++}return l},[O,M,r.cellSettings,r.columnSettings]),[N,R]=(0,i.useState)((null==(n=r.columnSettings)?void 0:n.filter(e=>void 0!==e.sort).map(e=>({id:e.name,desc:"desc"===e.sort})))??[]),[$,L]=(0,i.useState)([]),[B,G]=(0,i.useState)({}),[K,_]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!K)return;let e=e=>{let t=e.target;t.closest("[data-filter-dropdown]")||t.closest("button")||(G({}),_(null))},t=setTimeout(()=>{document.addEventListener("click",e)},100);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[K]);let q=(0,i.useMemo)(()=>{let e=[...O];return r.enableFiltering&&$.length>0&&(e=e.filter(e=>$.every(t=>{let n=e[t.id],l=t.value;return!l||0===l.length||l.includes(n)}))),e},[O,$,r.enableFiltering]);A.current=q;let[Q,J]=(0,i.useState)(r.pagination?{pageIndex:0,pageSize:10}:void 0);return((0,i.useEffect)(()=>{r.pagination&&!Q?J({pageIndex:0,pageSize:10}):!r.pagination&&Q&&J(void 0)},[r.pagination,Q]),void 0===o)?null:(null==O?void 0:O.length)?(0,l.jsxs)(l.Fragment,{children:[C,r.enableFiltering&&(0,l.jsx)("div",{style:{display:"flex",background:s.palette.background.default,borderBottom:`1px solid ${s.palette.divider}`,width:o.width,boxSizing:"border-box"},children:z.map((e,t)=>{var n;let i,o=(n=e.accessorKey,(i=$.find(e=>e.id===n))?i.value:[]),a=e.width||r.defaultColumnWidth;return(0,l.jsxs)("div",{style:{padding:"8px",borderRight:t<z.length-1?`1px solid ${s.palette.divider}`:"none",width:a,minWidth:a,maxWidth:a,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",flex:"number"==typeof a?"none":"1 1 auto"},children:[(0,l.jsx)("span",{style:{marginRight:8,fontSize:"12px",color:s.palette.text.secondary,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o.length?`${o.length} items`:"All"}),(0,l.jsx)("button",{onClick:t=>{var n;n=e.accessorKey,t.preventDefault(),t.stopPropagation(),G({...B,[n]:t.currentTarget}),_(n)},style:{border:`1px solid ${s.palette.divider}`,background:s.palette.background.paper,cursor:"pointer",fontSize:"12px",color:o.length?s.palette.primary.main:s.palette.text.secondary,padding:"4px 8px",borderRadius:"4px",minWidth:"20px",height:"24px",flexShrink:0,transition:"all 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.background=s.palette.action.hover},onMouseLeave:e=>{e.currentTarget.style.background=s.palette.background.paper},type:"button",children:"▼"}),K===e.accessorKey&&(0,l.jsx)("div",{style:{position:"absolute",top:"100%",left:0,zIndex:1e3,marginTop:4},children:(0,l.jsx)(P,{allValues:T[e.accessorKey]||[],selectedValues:o,onFilterChange:t=>{var n;let l;return n=e.accessorKey,l=$.filter(e=>e.id!==n),void(t.length>0&&l.push({id:n,value:t}),L(l))},theme:s})})]},`filter-${t}`)})}),(0,l.jsx)(f.Table,{data:q,columns:z,cellConfigs:D,height:r.enableFiltering?o.height-40:o.height,width:o.width,density:r.density,defaultColumnWidth:r.defaultColumnWidth,defaultColumnHeight:r.defaultColumnHeight,sorting:N,onSortingChange:R,pagination:Q,onPaginationChange:J,checkboxSelection:u,rowSelection:k,onRowSelectionChange:S,getItemActions:e=>{let{id:t,data:n}=e;return j({id:t,data:n})},hasItemActions:b&&b.length>0})]}):(0,l.jsx)(V.A,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:(0,l.jsx)(d.A,{children:"No data"})})},supportedQueryTypes:["TimeSeriesQuery"],queryOptions:U,panelOptionsEditorComponents:[{label:"General Settings",content:function(e){let{onChange:t,value:n}=e;return(0,l.jsx)(f.OptionsEditorGrid,{children:(0,l.jsx)(f.OptionsEditorColumn,{children:(0,l.jsxs)(f.OptionsEditorGroup,{title:"Display",children:[(0,l.jsx)(f.DensitySelector,{value:n.density,onChange:function(e){t({...n,density:e})}}),(0,l.jsx)(f.OptionsEditorControl,{label:"Pagination",control:(0,l.jsx)(A.A,{checked:!!n.pagination,onChange:function(e,l){t({...n,pagination:l})}})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Columns Hidden by Default",control:(0,l.jsx)(A.A,{checked:!!n.defaultColumnHidden,onChange:function(e,l){t({...n,defaultColumnHidden:l})}})}),(0,l.jsx)(f.OptionsEditorControl,{label:"Enable Column Filtering",control:(0,l.jsx)(A.A,{checked:!!n.enableFiltering,onChange:function(e,l){t({...n,enableFiltering:l})}})}),(0,l.jsx)(B,{label:"Width",defaultValue:f.DEFAULT_COLUMN_WIDTH,value:n.defaultColumnWidth,onChange:function(e){t({...n,defaultColumnWidth:e})}}),(0,l.jsx)(B,{label:"Height",defaultValue:f.DEFAULT_COLUMN_HEIGHT,value:n.defaultColumnHeight,onChange:function(e){t({...n,defaultColumnHeight:e})}})]})})})}},{label:"Column Settings",content:function(e){let{onChange:t,value:n}=e;return(0,l.jsx)(R,{columnSettings:n.columnSettings??[],onChange:function(e){t({...n,columnSettings:e})}})}},{label:"Cell Settings",content:function(e){let{onChange:t,value:n}=e;return(0,l.jsx)(b,{cellSettings:n.cellSettings??[],onChange:function(e){t({...n,cellSettings:e})}})}},{label:"Transforms",content:function(e){let{value:t,onChange:n}=e;return(0,l.jsx)(f.TransformsEditor,{value:t.transforms??[],onChange:function(e){n({...t,transforms:e})}})}},{label:"Item Actions",content:function(e){let{value:t,onChange:n}=e;return(0,l.jsx)(y.ItemSelectionActionsEditor,{actionOptions:t.actions,onChangeActions:function(e){n({...t,actions:e})},selectionOptions:t.selection,onChangeSelection:function(e){n({...t,selection:e})}})}}],createInitialOptions:function(){return{density:"standard",enableFiltering:!0}}}}}]);
|