@perses-dev/table-plugin 0.11.1 → 0.11.2
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.057041ac.js → Table.e34e0ae1.js} +3 -3
- package/__mf/js/async/__federation_expose_Table.894a962f.js +1 -0
- package/__mf/js/{main.2181a7b4.js → main.5b8b137b.js} +2 -2
- package/lib/TableExportAction.d.ts +16 -0
- package/lib/TableExportAction.d.ts.map +1 -1
- package/lib/TableExportAction.js +78 -25
- package/lib/TableExportAction.js.map +1 -1
- package/lib/cjs/TableExportAction.js +84 -27
- package/lib/cjs/components/TablePanel.js +5 -45
- package/lib/cjs/table-data-utils.js +83 -0
- package/lib/components/TablePanel.d.ts.map +1 -1
- package/lib/components/TablePanel.js +5 -45
- package/lib/components/TablePanel.js.map +1 -1
- package/lib/table-data-utils.d.ts +32 -0
- package/lib/table-data-utils.d.ts.map +1 -0
- package/lib/table-data-utils.js +81 -0
- package/lib/table-data-utils.js.map +1 -0
- package/mf-manifest.json +3 -3
- package/mf-stats.json +5 -5
- package/package.json +1 -1
- package/__mf/js/async/__federation_expose_Table.5e9f3060.js +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright 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
|
+
/**
|
|
14
|
+
* Determines the query mode based on table options.
|
|
15
|
+
* If any column has a plugin (embedded panel), use range mode; otherwise instant.
|
|
16
|
+
*/ export function getTablePanelQueryMode(spec) {
|
|
17
|
+
return (spec.columnSettings ?? []).some((c)=>c.plugin) ? 'range' : 'instant';
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Converts raw query results into a tabular format.
|
|
21
|
+
*
|
|
22
|
+
* This is the shared data-building logic used by both TablePanel (for rendering)
|
|
23
|
+
* and TableExportAction (for CSV export). Extracting this ensures both use the
|
|
24
|
+
* same transformation logic, reducing drift.
|
|
25
|
+
*
|
|
26
|
+
* @param queryResults - The panel query results containing time series data
|
|
27
|
+
* @param spec - The table options specification
|
|
28
|
+
* @param options - Build options (e.g., forExport mode)
|
|
29
|
+
* @returns Array of row objects with column keys and values
|
|
30
|
+
*/ export function buildRawTableData(queryResults, spec, options = {}) {
|
|
31
|
+
const { forExport = false } = options;
|
|
32
|
+
const queryMode = getTablePanelQueryMode(spec);
|
|
33
|
+
return queryResults.flatMap((data, queryIndex)=>(data.data?.series ?? []).map((ts)=>({
|
|
34
|
+
data,
|
|
35
|
+
ts,
|
|
36
|
+
queryIndex
|
|
37
|
+
}))).map(({ data, ts, queryIndex })=>{
|
|
38
|
+
if (ts.values[0] === undefined) {
|
|
39
|
+
return {
|
|
40
|
+
...ts.labels
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// If there are multiple queries, add query index to value key and label keys to avoid conflicts
|
|
44
|
+
const valueColumnName = queryResults.length === 1 ? 'value' : `value #${queryIndex + 1}`;
|
|
45
|
+
const labels = queryResults.length === 1 ? ts.labels : Object.entries(ts.labels ?? {}).reduce((acc, [key, value])=>{
|
|
46
|
+
if (key) acc[`${key} #${queryIndex + 1}`] = value;
|
|
47
|
+
return acc;
|
|
48
|
+
}, {});
|
|
49
|
+
// For export: always use raw scalar values
|
|
50
|
+
// For rendering: plugin columns get embedded PanelData objects
|
|
51
|
+
let columnValue;
|
|
52
|
+
if (forExport) {
|
|
53
|
+
columnValue = ts.values[0][1];
|
|
54
|
+
} else {
|
|
55
|
+
const hasPlugin = (spec.columnSettings ?? []).find((x)=>x.name === valueColumnName)?.plugin;
|
|
56
|
+
columnValue = hasPlugin ? {
|
|
57
|
+
...data,
|
|
58
|
+
data: {
|
|
59
|
+
...data.data,
|
|
60
|
+
series: data.data.series.filter((s)=>s === ts)
|
|
61
|
+
}
|
|
62
|
+
} : ts.values[0][1];
|
|
63
|
+
}
|
|
64
|
+
if (queryMode === 'instant') {
|
|
65
|
+
// Timestamp is not indexed as it will be the same for all queries
|
|
66
|
+
return {
|
|
67
|
+
timestamp: ts.values[0][0],
|
|
68
|
+
[valueColumnName]: columnValue,
|
|
69
|
+
...labels
|
|
70
|
+
};
|
|
71
|
+
} else {
|
|
72
|
+
// Don't add a timestamp for range queries
|
|
73
|
+
return {
|
|
74
|
+
[valueColumnName]: columnValue,
|
|
75
|
+
...labels
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=table-data-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/table-data-utils.ts"],"sourcesContent":["// Copyright 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 { Labels, TimeSeries, TimeSeriesData } from '@perses-dev/core';\nimport { PanelData } from '@perses-dev/plugin-system';\nimport { TableOptions } from './models';\n\n/**\n * Options for building raw table data.\n */\nexport interface BuildRawTableDataOptions {\n /**\n * When true, always use raw scalar values for cell data (for export).\n * When false, plugin columns will contain embedded PanelData objects (for rendering).\n */\n forExport?: boolean;\n}\n\n/**\n * Determines the query mode based on table options.\n * If any column has a plugin (embedded panel), use range mode; otherwise instant.\n */\nexport function getTablePanelQueryMode(spec: TableOptions): 'instant' | 'range' {\n return (spec.columnSettings ?? []).some((c) => c.plugin) ? 'range' : 'instant';\n}\n\n/**\n * Converts raw query results into a tabular format.\n *\n * This is the shared data-building logic used by both TablePanel (for rendering)\n * and TableExportAction (for CSV export). Extracting this ensures both use the\n * same transformation logic, reducing drift.\n *\n * @param queryResults - The panel query results containing time series data\n * @param spec - The table options specification\n * @param options - Build options (e.g., forExport mode)\n * @returns Array of row objects with column keys and values\n */\nexport function buildRawTableData(\n queryResults: Array<PanelData<TimeSeriesData>>,\n spec: TableOptions,\n options: BuildRawTableDataOptions = {}\n): Array<Record<string, unknown>> {\n const { forExport = false } = options;\n const queryMode = getTablePanelQueryMode(spec);\n\n return queryResults\n .flatMap((data: PanelData<TimeSeriesData>, queryIndex: number) =>\n (data.data?.series ?? []).map((ts: TimeSeries) => ({ data, ts, queryIndex }))\n )\n .map(({ data, ts, queryIndex }: { data: PanelData<TimeSeriesData>; ts: TimeSeries; queryIndex: number }) => {\n if (ts.values[0] === undefined) {\n return { ...ts.labels };\n }\n\n // If there are multiple queries, add query index to value key and label keys to avoid conflicts\n const valueColumnName = queryResults.length === 1 ? 'value' : `value #${queryIndex + 1}`;\n const labels =\n queryResults.length === 1\n ? ts.labels\n : Object.entries(ts.labels ?? {}).reduce((acc, [key, value]) => {\n if (key) acc[`${key} #${queryIndex + 1}`] = value;\n return acc;\n }, {} as Labels);\n\n // For export: always use raw scalar values\n // For rendering: plugin columns get embedded PanelData objects\n let columnValue: unknown;\n if (forExport) {\n columnValue = ts.values[0][1];\n } else {\n const hasPlugin = (spec.columnSettings ?? []).find((x) => x.name === valueColumnName)?.plugin;\n columnValue = hasPlugin\n ? { ...data, data: { ...data.data, series: data.data.series.filter((s) => s === ts) } }\n : ts.values[0][1];\n }\n\n if (queryMode === 'instant') {\n // Timestamp is not indexed as it will be the same for all queries\n return { timestamp: ts.values[0][0], [valueColumnName]: columnValue, ...labels };\n } else {\n // Don't add a timestamp for range queries\n return { [valueColumnName]: columnValue, ...labels };\n }\n });\n}\n"],"names":["getTablePanelQueryMode","spec","columnSettings","some","c","plugin","buildRawTableData","queryResults","options","forExport","queryMode","flatMap","data","queryIndex","series","map","ts","values","undefined","labels","valueColumnName","length","Object","entries","reduce","acc","key","value","columnValue","hasPlugin","find","x","name","filter","s","timestamp"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAiBjC;;;CAGC,GACD,OAAO,SAASA,uBAAuBC,IAAkB;IACvD,OAAO,AAACA,CAAAA,KAAKC,cAAc,IAAI,EAAE,AAAD,EAAGC,IAAI,CAAC,CAACC,IAAMA,EAAEC,MAAM,IAAI,UAAU;AACvE;AAEA;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,kBACdC,YAA8C,EAC9CN,IAAkB,EAClBO,UAAoC,CAAC,CAAC;IAEtC,MAAM,EAAEC,YAAY,KAAK,EAAE,GAAGD;IAC9B,MAAME,YAAYV,uBAAuBC;IAEzC,OAAOM,aACJI,OAAO,CAAC,CAACC,MAAiCC,aACzC,AAACD,CAAAA,KAAKA,IAAI,EAAEE,UAAU,EAAE,AAAD,EAAGC,GAAG,CAAC,CAACC,KAAoB,CAAA;gBAAEJ;gBAAMI;gBAAIH;YAAW,CAAA,IAE3EE,GAAG,CAAC,CAAC,EAAEH,IAAI,EAAEI,EAAE,EAAEH,UAAU,EAA2E;QACrG,IAAIG,GAAGC,MAAM,CAAC,EAAE,KAAKC,WAAW;YAC9B,OAAO;gBAAE,GAAGF,GAAGG,MAAM;YAAC;QACxB;QAEA,gGAAgG;QAChG,MAAMC,kBAAkBb,aAAac,MAAM,KAAK,IAAI,UAAU,CAAC,OAAO,EAAER,aAAa,GAAG;QACxF,MAAMM,SACJZ,aAAac,MAAM,KAAK,IACpBL,GAAGG,MAAM,GACTG,OAAOC,OAAO,CAACP,GAAGG,MAAM,IAAI,CAAC,GAAGK,MAAM,CAAC,CAACC,KAAK,CAACC,KAAKC,MAAM;YACvD,IAAID,KAAKD,GAAG,CAAC,GAAGC,IAAI,EAAE,EAAEb,aAAa,GAAG,CAAC,GAAGc;YAC5C,OAAOF;QACT,GAAG,CAAC;QAEV,2CAA2C;QAC3C,+DAA+D;QAC/D,IAAIG;QACJ,IAAInB,WAAW;YACbmB,cAAcZ,GAAGC,MAAM,CAAC,EAAE,CAAC,EAAE;QAC/B,OAAO;YACL,MAAMY,YAAY,AAAC5B,CAAAA,KAAKC,cAAc,IAAI,EAAE,AAAD,EAAG4B,IAAI,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAKZ,kBAAkBf;YACvFuB,cAAcC,YACV;gBAAE,GAAGjB,IAAI;gBAAEA,MAAM;oBAAE,GAAGA,KAAKA,IAAI;oBAAEE,QAAQF,KAAKA,IAAI,CAACE,MAAM,CAACmB,MAAM,CAAC,CAACC,IAAMA,MAAMlB;gBAAI;YAAE,IACpFA,GAAGC,MAAM,CAAC,EAAE,CAAC,EAAE;QACrB;QAEA,IAAIP,cAAc,WAAW;YAC3B,kEAAkE;YAClE,OAAO;gBAAEyB,WAAWnB,GAAGC,MAAM,CAAC,EAAE,CAAC,EAAE;gBAAE,CAACG,gBAAgB,EAAEQ;gBAAa,GAAGT,MAAM;YAAC;QACjF,OAAO;YACL,0CAA0C;YAC1C,OAAO;gBAAE,CAACC,gBAAgB,EAAEQ;gBAAa,GAAGT,MAAM;YAAC;QACrD;IACF;AACJ"}
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "Table",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.11.
|
|
8
|
+
"buildVersion": "0.11.2",
|
|
9
9
|
"buildName": "@perses-dev/table-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/Table.
|
|
12
|
+
"name": "__mf/js/Table.e34e0ae1.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
"__mf/js/async/9051.e3054e02.js",
|
|
325
325
|
"__mf/js/async/868.9f710584.js",
|
|
326
326
|
"__mf/js/async/1103.ffbc2bec.js",
|
|
327
|
-
"__mf/js/async/__federation_expose_Table.
|
|
327
|
+
"__mf/js/async/__federation_expose_Table.894a962f.js"
|
|
328
328
|
],
|
|
329
329
|
"async": [
|
|
330
330
|
"__mf/js/async/lib-router.2e1dec85.js",
|
package/mf-stats.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "Table",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.11.
|
|
8
|
+
"buildVersion": "0.11.2",
|
|
9
9
|
"buildName": "@perses-dev/table-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/Table.
|
|
12
|
+
"name": "__mf/js/Table.e34e0ae1.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -378,8 +378,8 @@
|
|
|
378
378
|
"react",
|
|
379
379
|
"@perses-dev/components",
|
|
380
380
|
"@perses-dev/plugin-system",
|
|
381
|
-
"@perses-dev/
|
|
382
|
-
"@perses-dev/
|
|
381
|
+
"@perses-dev/core",
|
|
382
|
+
"@perses-dev/dashboards"
|
|
383
383
|
],
|
|
384
384
|
"file": "src/Table.ts",
|
|
385
385
|
"assets": {
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
"__mf/js/async/9051.e3054e02.js",
|
|
389
389
|
"__mf/js/async/868.9f710584.js",
|
|
390
390
|
"__mf/js/async/1103.ffbc2bec.js",
|
|
391
|
-
"__mf/js/async/__federation_expose_Table.
|
|
391
|
+
"__mf/js/async/__federation_expose_Table.894a962f.js"
|
|
392
392
|
],
|
|
393
393
|
"async": [
|
|
394
394
|
"__mf/js/async/lib-router.2e1dec85.js",
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.chunk_Table=self.chunk_Table||[]).push([["2669"],{54042:function(e,t,n){var l;t.default=void 0,t.default=(0,((l=n(1448))&&l.__esModule?l:{default:l}).default)("M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z","Download")},37687:function(e,t,n){n.r(t),n.d(t,{Table:()=>G});var l=n(62540),i=n(70451),o=n.n(i),a=n(54381),r=n(315),s=n(93648),c=n(97653),d=n(88091),u=n(47095),h=n(65211),p=n(6227),x=n(7013),g=n(86067),m=n(86742),f=n(47390);function v(e,t){for(let l of t)if(function(e,t){var n,l,i,o,a,r,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==(a=e.spec)?void 0:a.max)!==void 0)return n<=+e.spec.max;return!1}case"Regex":if(!(null==(r=e.spec)?void 0:r.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)(a.A,{container:!0,spacing:2,...p,children:[(0,l.jsx)(a.A,{size:{xs:5},children:(0,l.jsxs)(r.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)(r.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)(r.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)(r.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)(r.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,a,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(r.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==(a=e.spec)?void 0:a.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(r.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)(a.A,{size:{xs:4},children:(0,l.jsxs)(r.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)(r.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)(a.A,{size:{xs:1},children:(0,l.jsx)(r.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)(a.A,{size:{xs:1},children:(0,l.jsx)(r.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)(a.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)(g.default,{})},"delete-cell-button")})})]})}function C(e){let{cellSettings:t=[],onChange:n,addButtonText:i="Add Conditional Format"}=e;return(0,l.jsxs)(r.A,{spacing:3,sx:{mt:2},children:[(0,l.jsxs)(a.A,{container:!0,spacing:3,children:[(0,l.jsx)(a.A,{size:{xs:5},children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Condition"})}),(0,l.jsx)(a.A,{size:{xs:4},children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Display Text"})}),(0,l.jsx)(a.A,{size:{xs:1},textAlign:"center",children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Color"})}),(0,l.jsx)(a.A,{size:{xs:1},textAlign:"center",children:(0,l.jsx)(d.A,{variant:"subtitle1",children:"Background"})}),(0,l.jsx)(a.A,{size:{xs:1}})]}),(0,l.jsx)(r.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)(x.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(50814),S=n(42524);let E=e=>{let{onChange:t,column:n,column:{dataLink:i}}=e;if(!i)return(0,l.jsxs)(r.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:a,title:s}=i;return(0,l.jsxs)(r.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:a}}),(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,[a,c]=(0,i.useState)(void 0===t.width||"auto"===t.width?100:t.width);return(0,l.jsxs)(r.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)(x.A,{variant:t.plugin?"outlined":"contained",onClick:()=>n({...t,plugin:void 0}),children:"Text"}),(0,l.jsx)(x.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?a:"auto"})})}),void 0!==t.width&&"auto"!==t.width&&(0,l.jsx)(f.OptionsEditorControl,{label:"Width",control:(0,l.jsx)(s.A,{type:"number",value:a,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)(r.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),D=n(87275),T=n(1355),z=n(78536);function N(e){let{column:t,isCollapsed:n,onChange:i,onCollapse:o,onDelete:a,onMoveUp:s,onMoveDown:c}=e;return(0,l.jsxs)(f.DragAndDropElement,{data:t,children:[(0,l.jsxs)(r.A,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,justifyContent:"space-between",gap:4,children:[(0,l.jsxs)(r.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)(D.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)(r.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)(z.default,{}):(0,l.jsx)(T.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:a,children:(0,l.jsx)(g.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,a]=(0,i.useState)(t.map(()=>!0));return(0,f.useDragAndDropMonitor)({elements:t,accessKey:"name",onChange:n}),(0,l.jsxs)(r.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),a(e=>(e.splice(i,1),[...e]))},onCollapse:e=>{a(t=>(t[i]=e,[...t]))},onMoveUp:()=>n((0,f.handleMoveUp)(e,t)),onMoveDown:()=>n((0,f.handleMoveDown)(e,t))},i)),(0,l.jsx)(x.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),a(e=>(e.push(!1),[...e]))},children:"Add Column Settings"})]})}var L=n(86214),I=n(85180);function V(e){let{kind:t,spec:n,queryResults:i}=e,{ref:o,width:a=1,height:r=1}=(0,I.default)();return(0,l.jsx)("div",{ref:o,style:{height:"100%"},children:(0,l.jsx)(f.ErrorBoundary,{FallbackComponent:f.ErrorAlert,children:(0,l.jsx)(L.PanelPluginLoader,{kind:t,contentDimensions:{width:a,height:r},spec:n,queryResults:i})})})}var $=n(56599),F=n(74628),H=n(79977);function W(e){let{allValues:t,selectedValues:n,onFilterChange:i,theme:o}=e,a=[...new Set(t)].filter(e=>null!==e).sort();return 0===a.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===a.length&&a.length>0,onChange:e=>i(e.target.checked?a:[]),style:{marginRight:8}}),(0,l.jsxs)("span",{style:{color:o.palette.text.primary},children:["Select All (",a.length,")"]})]})}),(0,l.jsx)("hr",{style:{margin:"8px 0",border:"none",borderTop:`1px solid ${o.palette.divider}`}}),a.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 P(e,t,n){for(let i of t)if(i.name===e){if(i.hide)return;let{name:e,header:t,headerDescription:o,enableSorting:a,width:r,align:s,dataLink:c}=i;return{accessorKey:e,header:t??e,headerDescription:o,enableSorting:a,width:r,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)(V,{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,H.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 _(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))})})]})}var B=n(54042);let G={PanelComponent:function(e){var t,n;let{contentDimensions:o,spec:a,queryResults:r}=e,s=(0,$.A)(),c=(0,y.useAllVariableValues)(),u=(null==(t=a.selection)?void 0:t.enabled)??!1,{selectionMap:h,setSelection:p,clearSelection:x}=(0,f.useSelection)(),g=a.actions?a.actions:void 0,m=(null==g?void 0:g.enabled)&&g.displayWithItem?g.actionsList:[],{getItemActionButtons:j,confirmDialog:C,actionButtons:b}=(0,L.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?x():p(t)},[p,x]),E=U(a).mode,w=(0,i.useMemo)(()=>r.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===r.length?"value":`value #${i+1}`,s=1===r.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=(a.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}}),[r,E,a.columnSettings]),O=(0,i.useMemo)(()=>(0,H.transformData)(w,a.transforms??[]),[w,a.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]),D=(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]),T=(0,i.useMemo)(()=>{let e=[],t=new Set;for(let n of a.columnSettings??[]){if(t.has(n.name))continue;let l=P(n.name,a.columnSettings??[],c);void 0!==l&&(e.push(l),t.add(n.name))}if(!a.defaultColumnHidden){for(let n of M)if(!t.has(n)){let t=P(n,a.columnSettings??[],c);void 0!==t&&e.push(t)}}return e},[M,a.columnSettings,a.defaultColumnHidden,c]),z=(0,i.useMemo)(()=>{var e,t,n;if(void 0===a.cellSettings&&!(null==(e=a.columnSettings)?void 0:e.some(e=>void 0!==e.cellSettings)))return{};let l={},i=0;for(let e of O){for(let[o,r]of Object.entries({...M.reduce((e,t)=>(e[t]=void 0,e),{}),...e})){let e=v(r,a.cellSettings??[]),s=null==(t=a.columnSettings)?void 0:t.find(e=>e.name===o);if(null==s||null==(n=s.cellSettings)?void 0:n.length){let t=v(r,s.cellSettings);t&&(e=t)}e&&(l[`${i}_${o}`]=e)}i++}return l},[O,M,a.cellSettings,a.columnSettings]),[N,R]=(0,i.useState)((null==(n=a.columnSettings)?void 0:n.filter(e=>void 0!==e.sort).map(e=>({id:e.name,desc:"desc"===e.sort})))??[]),[I,V]=(0,i.useState)([]),[_,B]=(0,i.useState)({}),[G,K]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(!G)return;let e=e=>{let t=e.target;t.closest("[data-filter-dropdown]")||t.closest("button")||(B({}),K(null))},t=setTimeout(()=>{document.addEventListener("click",e)},100);return()=>{clearTimeout(t),document.removeEventListener("click",e)}},[G]);let q=(0,i.useMemo)(()=>{let e=[...O];return a.enableFiltering&&I.length>0&&(e=e.filter(e=>I.every(t=>{let n=e[t.id],l=t.value;return!l||0===l.length||l.includes(n)}))),e},[O,I,a.enableFiltering]);A.current=q;let[Q,J]=(0,i.useState)(a.pagination?{pageIndex:0,pageSize:10}:void 0);return((0,i.useEffect)(()=>{a.pagination&&!Q?J({pageIndex:0,pageSize:10}):!a.pagination&&Q&&J(void 0)},[a.pagination,Q]),void 0===o)?null:(null==O?void 0:O.length)?(0,l.jsxs)(l.Fragment,{children:[C,a.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:T.map((e,t)=>{var n;let i,o=(n=e.accessorKey,(i=I.find(e=>e.id===n))?i.value:[]),r=e.width||a.defaultColumnWidth;return(0,l.jsxs)("div",{style:{padding:"8px",borderRight:t<T.length-1?`1px solid ${s.palette.divider}`:"none",width:r,minWidth:r,maxWidth:r,display:"flex",alignItems:"center",position:"relative",boxSizing:"border-box",flex:"number"==typeof r?"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(),B({..._,[n]:t.currentTarget}),K(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:"▼"}),G===e.accessorKey&&(0,l.jsx)("div",{style:{position:"absolute",top:"100%",left:0,zIndex:1e3,marginTop:4},children:(0,l.jsx)(W,{allValues:D[e.accessorKey]||[],selectedValues:o,onFilterChange:t=>{var n;let l;return n=e.accessorKey,l=I.filter(e=>e.id!==n),void(t.length>0&&l.push({id:n,value:t}),V(l))},theme:s})})]},`filter-${t}`)})}),(0,l.jsx)(f.Table,{data:q,columns:T,cellConfigs:z,height:a.enableFiltering?o.height-40:o.height,width:o.width,density:a.density,defaultColumnWidth:a.defaultColumnWidth,defaultColumnHeight:a.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)(F.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)(_,{label:"Width",defaultValue:f.DEFAULT_COLUMN_WIDTH,value:n.defaultColumnWidth,onChange:function(e){t({...n,defaultColumnWidth:e})}}),(0,l.jsx)(_,{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}},actions:[{component:e=>{let{queryResults:t,definition:n}=e,o=(0,i.useMemo)(()=>(0,y.extractExportableData)(t),[t]),a=(0,i.useMemo)(()=>(0,y.isExportableData)(o),[o]),r=(0,i.useCallback)(()=>{if(o&&a)try{var e,t;let l=(null==n||null==(t=n.spec)||null==(e=t.display)?void 0:e.name)||"Time Series Data",i=(0,y.exportDataAsCSV)({data:o}),a=(0,y.sanitizeFilename)(l),r=`${a}_data.csv`,s=document.createElement("a");s.href=URL.createObjectURL(i),s.download=r,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(s.href)}catch(e){console.error("Time series export failed:",e)}},[o,a,n]);return a?(0,l.jsx)(f.InfoTooltip,{description:"Export as CSV",children:(0,l.jsx)(u.A,{size:"small",onClick:r,"aria-label":"Export time series data as CSV",children:(0,l.jsx)(B.default,{fontSize:"inherit"})})}):null},location:"header"}]}}}]);
|