@perses-dev/table-plugin 0.11.1 → 0.13.0-beta.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/css/async/5286.85c2cbf6.css +1 -0
- package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
- package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
- package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
- package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
- package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
- package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
- package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
- package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
- package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
- package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
- package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
- package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
- package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
- package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
- package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
- package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
- package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
- package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
- package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
- package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
- package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
- package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
- package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
- package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
- package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
- package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
- package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
- package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
- package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
- package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
- package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
- package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
- package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
- package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
- package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
- package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
- package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
- package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
- package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
- package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
- package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
- package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
- package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
- package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
- package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
- package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
- package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
- package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
- package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
- package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
- package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
- package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
- package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
- package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
- package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
- package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
- package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
- package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
- package/__mf/js/Table.5ec41996.js +7 -0
- package/__mf/js/async/1432.47ca9bc7.js +1 -0
- package/__mf/js/async/1519.446ee3b5.js +1 -0
- package/__mf/js/async/1616.29b0085e.js +1 -0
- package/__mf/js/async/1805.b4a1e768.js +1 -0
- package/__mf/js/async/2043.0b0ffaef.js +2 -0
- package/__mf/js/async/2082.c0b3db38.js +1 -0
- package/__mf/js/async/256.7929d7f5.js +1 -0
- package/__mf/js/async/2842.cee1ed42.js +1 -0
- package/__mf/js/async/392.eef36bcd.js +2 -0
- package/__mf/js/async/4121.403fdade.js +2 -0
- package/__mf/js/async/4320.5cbfbd1c.js +1 -0
- package/__mf/js/async/5002.fd6ad994.js +1 -0
- package/__mf/js/async/5071.1684b9fd.js +1 -0
- package/__mf/js/async/5183.acc536f9.js +22 -0
- package/__mf/js/async/5286.1b3a5a62.js +7 -0
- package/__mf/js/async/{550.8bab52fc.js.LICENSE.txt → 5286.1b3a5a62.js.LICENSE.txt} +19 -1
- package/__mf/js/async/5587.966d92d2.js +1 -0
- package/__mf/js/async/6274.71776a1d.js +2 -0
- package/__mf/js/async/6753.5632301a.js +1 -0
- package/__mf/js/async/6811.6a011de7.js +38 -0
- package/__mf/js/async/7177.f0c1cf85.js +1 -0
- package/__mf/js/async/7192.f9d57dbb.js +1 -0
- package/__mf/js/async/7413.a78d135c.js +1 -0
- package/__mf/js/async/7862.de8ef786.js +2 -0
- package/__mf/js/async/7968.545aab42.js +1 -0
- package/__mf/js/async/7978.61f7fc2d.js +1 -0
- package/__mf/js/async/8356.7a060c2c.js +1 -0
- package/__mf/js/async/8470.dac32d6a.js +2 -0
- package/__mf/js/async/868.a08b9f5f.js +110 -0
- package/__mf/js/async/{868.9f710584.js.LICENSE.txt → 868.a08b9f5f.js.LICENSE.txt} +1 -1
- package/__mf/js/async/873.bb80627c.js +1 -0
- package/__mf/js/async/8750.8dc0b93d.js +3 -0
- package/__mf/js/async/9051.2db4f8e5.js +1 -0
- package/__mf/js/async/9235.35b8884a.js +1 -0
- package/__mf/js/async/941.97799379.js +2 -0
- package/__mf/js/async/9546.f3c1cf02.js +2 -0
- package/__mf/js/async/{1117.b21b0ae4.js.LICENSE.txt → 9546.f3c1cf02.js.LICENSE.txt} +1 -1
- package/__mf/js/async/9588.178c0b3f.js +1 -0
- package/__mf/js/async/9701.4ae63d2f.js +1 -0
- package/__mf/js/async/__federation_expose_Table.7060f62e.js +1 -0
- package/__mf/js/async/lib-router.96861d20.js +2 -0
- package/__mf/js/main.8677f3d2.js +7 -0
- package/lib/TableExportAction.d.ts +16 -0
- package/lib/TableExportAction.d.ts.map +1 -1
- package/lib/TableExportAction.js +78 -26
- package/lib/TableExportAction.js.map +1 -1
- package/lib/cjs/TableExportAction.js +83 -27
- package/lib/cjs/components/ColumnsEditor/ColumnEditor.js +60 -22
- package/lib/cjs/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +124 -0
- package/lib/cjs/components/TablePanel.js +206 -56
- package/lib/cjs/models/table-model.js +32 -6
- package/lib/cjs/table-data-utils.js +83 -0
- package/lib/components/ColumnsEditor/ColumnEditor.d.ts.map +1 -1
- package/lib/components/ColumnsEditor/ColumnEditor.js +61 -23
- package/lib/components/ColumnsEditor/ColumnEditor.js.map +1 -1
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts +13 -0
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts.map +1 -0
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +114 -0
- package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js.map +1 -0
- package/lib/components/EmbeddedPanel.d.ts +1 -1
- package/lib/components/EmbeddedPanel.d.ts.map +1 -1
- package/lib/components/EmbeddedPanel.js.map +1 -1
- package/lib/components/TablePanel.d.ts +1 -1
- package/lib/components/TablePanel.d.ts.map +1 -1
- package/lib/components/TablePanel.js +206 -56
- package/lib/components/TablePanel.js.map +1 -1
- package/lib/components/TableTransformsEditor.d.ts.map +1 -1
- package/lib/components/TableTransformsEditor.js.map +1 -1
- package/lib/models/table-model.d.ts +2 -2
- package/lib/models/table-model.d.ts.map +1 -1
- package/lib/models/table-model.js +32 -6
- package/lib/models/table-model.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/lib/test/mock-query-results.d.ts +1 -1
- package/lib/test/mock-query-results.js.map +1 -1
- package/mf-manifest.json +94 -75
- package/mf-stats.json +110 -79
- package/package.json +5 -5
- package/__mf/css/async/3061.d3010b86.css +0 -1
- package/__mf/css/async/5442.d3010b86.css +0 -1
- package/__mf/css/async/7823.d3010b86.css +0 -1
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/Table.057041ac.js +0 -6
- package/__mf/js/async/1103.ffbc2bec.js +0 -1
- package/__mf/js/async/1117.b21b0ae4.js +0 -2
- package/__mf/js/async/1432.acd0ad59.js +0 -1
- package/__mf/js/async/1616.7a74f4ef.js +0 -1
- package/__mf/js/async/2043.fdebf89c.js +0 -2
- package/__mf/js/async/208.2b17c08c.js +0 -3
- package/__mf/js/async/2082.78532c3c.js +0 -1
- package/__mf/js/async/272.3bc7825c.js +0 -1
- package/__mf/js/async/392.49e51fc5.js +0 -2
- package/__mf/js/async/4121.8e97ef88.js +0 -2
- package/__mf/js/async/5002.3189d214.js +0 -1
- package/__mf/js/async/5019.5318688a.js +0 -1
- package/__mf/js/async/5071.91e1c002.js +0 -1
- package/__mf/js/async/54.8b007a26.js +0 -22
- package/__mf/js/async/550.8bab52fc.js +0 -7
- package/__mf/js/async/5587.f5f2b0cc.js +0 -1
- package/__mf/js/async/6274.14683c28.js +0 -2
- package/__mf/js/async/6283.e044c368.js +0 -2
- package/__mf/js/async/6753.032ce611.js +0 -1
- package/__mf/js/async/6811.4e18bc66.js +0 -38
- package/__mf/js/async/7177.356298ae.js +0 -1
- package/__mf/js/async/7192.66c9e3a5.js +0 -1
- package/__mf/js/async/7968.a66bfadb.js +0 -1
- package/__mf/js/async/7978.a19f5a4f.js +0 -1
- package/__mf/js/async/8356.8ae40b6a.js +0 -1
- package/__mf/js/async/8470.1b8b20ff.js +0 -2
- package/__mf/js/async/868.9f710584.js +0 -110
- package/__mf/js/async/873.a7310675.js +0 -1
- package/__mf/js/async/9051.e3054e02.js +0 -1
- package/__mf/js/async/9235.eee50e10.js +0 -1
- package/__mf/js/async/941.333875f4.js +0 -2
- package/__mf/js/async/9588.7b021071.js +0 -1
- package/__mf/js/async/9701.3b068d23.js +0 -1
- package/__mf/js/async/__federation_expose_Table.5e9f3060.js +0 -1
- package/__mf/js/async/lib-router.2e1dec85.js +0 -2
- package/__mf/js/main.2181a7b4.js +0 -6
- /package/__mf/js/async/{2043.fdebf89c.js.LICENSE.txt → 2043.0b0ffaef.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{392.49e51fc5.js.LICENSE.txt → 392.eef36bcd.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{4121.8e97ef88.js.LICENSE.txt → 4121.403fdade.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{54.8b007a26.js.LICENSE.txt → 5183.acc536f9.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6274.14683c28.js.LICENSE.txt → 6274.71776a1d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6283.e044c368.js.LICENSE.txt → 7862.de8ef786.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{8470.1b8b20ff.js.LICENSE.txt → 8470.dac32d6a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{941.333875f4.js.LICENSE.txt → 941.97799379.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{lib-router.2e1dec85.js.LICENSE.txt → lib-router.96861d20.js.LICENSE.txt} +0 -0
|
@@ -14,10 +14,18 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get TableExportAction () {
|
|
20
25
|
return TableExportAction;
|
|
26
|
+
},
|
|
27
|
+
get buildTableData () {
|
|
28
|
+
return buildTableData;
|
|
21
29
|
}
|
|
22
30
|
});
|
|
23
31
|
const _jsxruntime = require("react/jsx-runtime");
|
|
@@ -26,6 +34,7 @@ const _pluginsystem = require("@perses-dev/plugin-system");
|
|
|
26
34
|
const _components = require("@perses-dev/components");
|
|
27
35
|
const _material = require("@mui/material");
|
|
28
36
|
const _Download = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Download"));
|
|
37
|
+
const _tabledatautils = require("./table-data-utils");
|
|
29
38
|
function _interop_require_default(obj) {
|
|
30
39
|
return obj && obj.__esModule ? obj : {
|
|
31
40
|
default: obj
|
|
@@ -72,39 +81,86 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
72
81
|
}
|
|
73
82
|
return newObj;
|
|
74
83
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
]);
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
function buildTableData(queryResults, spec) {
|
|
85
|
+
// Use shared utility with forExport=true to get raw scalar values
|
|
86
|
+
const rawData = (0, _tabledatautils.buildRawTableData)(queryResults, spec, {
|
|
87
|
+
forExport: true
|
|
88
|
+
});
|
|
89
|
+
const transformed = (0, _components.transformData)(rawData, spec.transforms ?? []);
|
|
90
|
+
const allKeys = [];
|
|
91
|
+
for (const entry of transformed){
|
|
92
|
+
for (const key of Object.keys(entry)){
|
|
93
|
+
if (!allKeys.includes(key)) allKeys.push(key);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const columnSettings = spec.columnSettings ?? [];
|
|
97
|
+
const columns = [];
|
|
98
|
+
const customized = new Set();
|
|
99
|
+
for (const col of columnSettings){
|
|
100
|
+
if (customized.has(col.name)) continue;
|
|
101
|
+
customized.add(col.name);
|
|
102
|
+
if (col.hide) continue;
|
|
103
|
+
columns.push({
|
|
104
|
+
key: col.name,
|
|
105
|
+
header: col.header ?? col.name
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (!spec.defaultColumnHidden) {
|
|
109
|
+
for (const key of allKeys){
|
|
110
|
+
if (!customized.has(key)) {
|
|
111
|
+
columns.push({
|
|
112
|
+
key,
|
|
113
|
+
header: key
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
data: transformed,
|
|
120
|
+
columns
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const TableExportAction = ({ queryResults, spec, definition })=>{
|
|
124
|
+
const tableData = (0, _react.useMemo)(()=>buildTableData(queryResults, spec), [
|
|
125
|
+
queryResults,
|
|
126
|
+
spec
|
|
85
127
|
]);
|
|
128
|
+
const canExport = tableData.data.length > 0 && tableData.columns.length > 0;
|
|
86
129
|
const handleExport = (0, _react.useCallback)(()=>{
|
|
87
|
-
if (!
|
|
130
|
+
if (!canExport) return;
|
|
88
131
|
try {
|
|
89
|
-
const title = definition?.spec?.display?.name || '
|
|
90
|
-
const
|
|
91
|
-
|
|
132
|
+
const title = definition?.spec?.display?.name || 'Table Data';
|
|
133
|
+
const { data, columns } = tableData;
|
|
134
|
+
const headerRow = columns.map((c)=>(0, _pluginsystem.escapeCsvValue)(c.header)).join(',');
|
|
135
|
+
const dataRows = data.map((row)=>columns.map((col)=>(0, _pluginsystem.escapeCsvValue)(row[col.key])).join(','));
|
|
136
|
+
const csvString = [
|
|
137
|
+
headerRow,
|
|
138
|
+
...dataRows
|
|
139
|
+
].join('\n') + '\n';
|
|
140
|
+
const csvBlob = new Blob([
|
|
141
|
+
csvString
|
|
142
|
+
], {
|
|
143
|
+
type: 'text/csv;charset=utf-8'
|
|
92
144
|
});
|
|
93
145
|
const baseFilename = (0, _pluginsystem.sanitizeFilename)(title);
|
|
94
146
|
const filename = `${baseFilename}_data.csv`;
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
147
|
+
const url = URL.createObjectURL(csvBlob);
|
|
148
|
+
try {
|
|
149
|
+
const link = document.createElement('a');
|
|
150
|
+
link.href = url;
|
|
151
|
+
link.download = filename;
|
|
152
|
+
document.body.appendChild(link);
|
|
153
|
+
link.click();
|
|
154
|
+
document.body.removeChild(link);
|
|
155
|
+
} finally{
|
|
156
|
+
URL.revokeObjectURL(url);
|
|
157
|
+
}
|
|
102
158
|
} catch (error) {
|
|
103
|
-
console.error('
|
|
159
|
+
console.error('Table CSV export failed:', error);
|
|
104
160
|
}
|
|
105
161
|
}, [
|
|
106
|
-
exportableData,
|
|
107
162
|
canExport,
|
|
163
|
+
tableData,
|
|
108
164
|
definition
|
|
109
165
|
]);
|
|
110
166
|
if (!canExport) {
|
|
@@ -115,7 +171,7 @@ const TableExportAction = ({ queryResults, definition })=>{
|
|
|
115
171
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
116
172
|
size: "small",
|
|
117
173
|
onClick: handleExport,
|
|
118
|
-
"aria-label": "Export
|
|
174
|
+
"aria-label": "Export table data as CSV",
|
|
119
175
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Download.default, {
|
|
120
176
|
fontSize: "inherit"
|
|
121
177
|
})
|
|
@@ -27,6 +27,7 @@ const _components = require("@perses-dev/components");
|
|
|
27
27
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
28
28
|
const _ConditionalPanel = require("../ConditionalPanel");
|
|
29
29
|
const _DataLinkEditorDialog = require("./DataLinkEditorDialog");
|
|
30
|
+
const _EmbeddedPanelOptionsEditor = require("./EmbeddedPanelOptionsEditor");
|
|
30
31
|
const DEFAULT_FORMAT = {
|
|
31
32
|
unit: 'decimal',
|
|
32
33
|
shortValues: true
|
|
@@ -125,39 +126,53 @@ function ColumnEditor({ column, onChange, ...others }) {
|
|
|
125
126
|
})
|
|
126
127
|
}),
|
|
127
128
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
128
|
-
label: "
|
|
129
|
-
control: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.
|
|
130
|
-
|
|
131
|
-
size: "small",
|
|
129
|
+
label: "Cell display",
|
|
130
|
+
control: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
131
|
+
spacing: 1,
|
|
132
132
|
children: [
|
|
133
|
-
/*#__PURE__*/ (0, _jsxruntime.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.ButtonGroup, {
|
|
134
|
+
"aria-label": "Cell display",
|
|
135
|
+
size: "small",
|
|
136
|
+
children: [
|
|
137
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
138
|
+
variant: !column.plugin ? 'contained' : 'outlined',
|
|
139
|
+
onClick: ()=>onChange({
|
|
140
|
+
...column,
|
|
141
|
+
plugin: undefined
|
|
142
|
+
}),
|
|
143
|
+
children: "Text"
|
|
138
144
|
}),
|
|
139
|
-
|
|
145
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
146
|
+
variant: column.plugin ? 'contained' : 'outlined',
|
|
147
|
+
onClick: ()=>onChange({
|
|
148
|
+
...column,
|
|
149
|
+
plugin: {
|
|
150
|
+
kind: 'GaugeChart',
|
|
151
|
+
spec: {}
|
|
152
|
+
}
|
|
153
|
+
}),
|
|
154
|
+
children: "Visualization"
|
|
155
|
+
})
|
|
156
|
+
]
|
|
140
157
|
}),
|
|
141
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.
|
|
142
|
-
variant:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
149
|
-
}),
|
|
150
|
-
children: "Embedded Panel"
|
|
158
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
159
|
+
variant: "caption",
|
|
160
|
+
color: "text.secondary",
|
|
161
|
+
sx: {
|
|
162
|
+
maxWidth: 360
|
|
163
|
+
},
|
|
164
|
+
children: "Visualizations reuse panel settings (thresholds, units, colors). Text mode uses value formatting below."
|
|
151
165
|
})
|
|
152
166
|
]
|
|
153
167
|
})
|
|
154
168
|
}),
|
|
155
169
|
column.plugin ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
156
|
-
label: "
|
|
170
|
+
label: "Visualization type",
|
|
157
171
|
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginKindSelect, {
|
|
158
172
|
pluginTypes: [
|
|
159
173
|
'Panel'
|
|
160
174
|
],
|
|
175
|
+
size: "small",
|
|
161
176
|
value: {
|
|
162
177
|
type: 'Panel',
|
|
163
178
|
kind: column.plugin.kind
|
|
@@ -231,9 +246,32 @@ function ColumnEditor({ column, onChange, ...others }) {
|
|
|
231
246
|
})
|
|
232
247
|
]
|
|
233
248
|
}),
|
|
249
|
+
column.plugin?.kind === 'GaugeChart' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
250
|
+
sx: {
|
|
251
|
+
px: 8,
|
|
252
|
+
mt: 4,
|
|
253
|
+
width: '100%'
|
|
254
|
+
},
|
|
255
|
+
spacing: 2,
|
|
256
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorGroup, {
|
|
257
|
+
title: "Visualization settings",
|
|
258
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_EmbeddedPanelOptionsEditor.EmbeddedPanelOptionsEditor, {
|
|
259
|
+
kind: "GaugeChart",
|
|
260
|
+
spec: column.plugin.spec,
|
|
261
|
+
onChange: (nextSpec)=>onChange({
|
|
262
|
+
...column,
|
|
263
|
+
plugin: {
|
|
264
|
+
kind: 'GaugeChart',
|
|
265
|
+
spec: nextSpec
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
})
|
|
269
|
+
})
|
|
270
|
+
}),
|
|
234
271
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
235
272
|
sx: {
|
|
236
|
-
px: 8
|
|
273
|
+
px: 8,
|
|
274
|
+
mt: column.plugin?.kind === 'GaugeChart' ? 3 : 0
|
|
237
275
|
},
|
|
238
276
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorGroup, {
|
|
239
277
|
title: "Conditional Cell Format",
|
|
@@ -0,0 +1,124 @@
|
|
|
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
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "EmbeddedPanelOptionsEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return EmbeddedPanelOptionsEditor;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _material = require("@mui/material");
|
|
25
|
+
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
26
|
+
const _merge = /*#__PURE__*/ _interop_require_default(require("lodash/merge"));
|
|
27
|
+
const _react = require("react");
|
|
28
|
+
function _interop_require_default(obj) {
|
|
29
|
+
return obj && obj.__esModule ? obj : {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function isSpecEmpty(spec) {
|
|
34
|
+
if (spec === undefined || spec === null) return true;
|
|
35
|
+
if (typeof spec !== 'object') return false;
|
|
36
|
+
return Object.keys(spec).length === 0;
|
|
37
|
+
}
|
|
38
|
+
function mergeWithPluginDefaults(plugin, spec) {
|
|
39
|
+
const initial = plugin.createInitialOptions() ?? {};
|
|
40
|
+
return (0, _merge.default)({}, initial, spec ?? {});
|
|
41
|
+
}
|
|
42
|
+
function EmbeddedPanelOptionsEditor({ kind, spec, onChange }) {
|
|
43
|
+
const { data: plugin, isLoading, isError, error } = (0, _pluginsystem.usePlugin)('Panel', kind);
|
|
44
|
+
const panelPlugin = plugin;
|
|
45
|
+
const mergedSpec = (0, _react.useMemo)(()=>{
|
|
46
|
+
if (!panelPlugin) {
|
|
47
|
+
return spec;
|
|
48
|
+
}
|
|
49
|
+
return mergeWithPluginDefaults(panelPlugin, spec);
|
|
50
|
+
}, [
|
|
51
|
+
panelPlugin,
|
|
52
|
+
spec
|
|
53
|
+
]);
|
|
54
|
+
const onChangeRef = (0, _react.useRef)(onChange);
|
|
55
|
+
onChangeRef.current = onChange;
|
|
56
|
+
// Persist plugin defaults when the column still has an empty spec (e.g. after switching panel kind).
|
|
57
|
+
(0, _react.useEffect)(()=>{
|
|
58
|
+
if (!panelPlugin || !isSpecEmpty(spec)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
onChangeRef.current(mergeWithPluginDefaults(panelPlugin, spec));
|
|
62
|
+
}, [
|
|
63
|
+
panelPlugin,
|
|
64
|
+
kind,
|
|
65
|
+
spec
|
|
66
|
+
]);
|
|
67
|
+
if (isLoading) {
|
|
68
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
69
|
+
direction: "row",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
spacing: 1,
|
|
72
|
+
sx: {
|
|
73
|
+
py: 1
|
|
74
|
+
},
|
|
75
|
+
children: [
|
|
76
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.CircularProgress, {
|
|
77
|
+
size: 22
|
|
78
|
+
}),
|
|
79
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
80
|
+
variant: "body2",
|
|
81
|
+
color: "text.secondary",
|
|
82
|
+
children: "Loading panel settings…"
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (isError || !plugin) {
|
|
88
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
89
|
+
variant: "body2",
|
|
90
|
+
color: "error",
|
|
91
|
+
children: error?.message ?? 'Could not load panel plugin.'
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const loadedPlugin = plugin;
|
|
95
|
+
const editorTabs = loadedPlugin.panelOptionsEditorComponents ?? [];
|
|
96
|
+
if (editorTabs.length === 0) {
|
|
97
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
98
|
+
variant: "body2",
|
|
99
|
+
color: "text.secondary",
|
|
100
|
+
children: "This visualization has no editable settings."
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
104
|
+
spacing: 2.5,
|
|
105
|
+
sx: {
|
|
106
|
+
width: '100%',
|
|
107
|
+
py: 1
|
|
108
|
+
},
|
|
109
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.OptionsEditorTabs, {
|
|
110
|
+
tabs: editorTabs.map((tab)=>{
|
|
111
|
+
const Content = tab.content;
|
|
112
|
+
return {
|
|
113
|
+
label: tab.label,
|
|
114
|
+
content: /*#__PURE__*/ (0, _jsxruntime.jsx)(Content, {
|
|
115
|
+
value: mergedSpec,
|
|
116
|
+
onChange: (next)=>{
|
|
117
|
+
onChange(next);
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
};
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|