@perses-dev/table-plugin 0.11.2 → 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.
Files changed (226) hide show
  1. package/__mf/css/async/5286.85c2cbf6.css +1 -0
  2. package/__mf/font/inter-cyrillic-300-normal.432f2b21.woff +0 -0
  3. package/__mf/font/inter-cyrillic-300-normal.9da91009.woff2 +0 -0
  4. package/__mf/font/inter-cyrillic-400-normal.372704ff.woff2 +0 -0
  5. package/__mf/font/inter-cyrillic-400-normal.a6b6ef6f.woff +0 -0
  6. package/__mf/font/inter-cyrillic-500-normal.7c15bba8.woff2 +0 -0
  7. package/__mf/font/inter-cyrillic-500-normal.b9f8c929.woff +0 -0
  8. package/__mf/font/inter-cyrillic-600-normal.2f42892a.woff2 +0 -0
  9. package/__mf/font/inter-cyrillic-600-normal.c3987adc.woff +0 -0
  10. package/__mf/font/inter-cyrillic-700-normal.93eba3c3.woff +0 -0
  11. package/__mf/font/inter-cyrillic-700-normal.e9e5b2dc.woff2 +0 -0
  12. package/__mf/font/inter-cyrillic-900-normal.f285bd7a.woff2 +0 -0
  13. package/__mf/font/inter-cyrillic-900-normal.ffbd8a3a.woff +0 -0
  14. package/__mf/font/inter-cyrillic-ext-300-normal.95bb9038.woff2 +0 -0
  15. package/__mf/font/inter-cyrillic-ext-300-normal.cfc143a9.woff +0 -0
  16. package/__mf/font/inter-cyrillic-ext-400-normal.2a31c04b.woff +0 -0
  17. package/__mf/font/inter-cyrillic-ext-400-normal.f572b170.woff2 +0 -0
  18. package/__mf/font/inter-cyrillic-ext-500-normal.5a6bb1da.woff +0 -0
  19. package/__mf/font/inter-cyrillic-ext-500-normal.fe0d9b14.woff2 +0 -0
  20. package/__mf/font/inter-cyrillic-ext-600-normal.ecbdecad.woff +0 -0
  21. package/__mf/font/inter-cyrillic-ext-600-normal.f7b3c15b.woff2 +0 -0
  22. package/__mf/font/inter-cyrillic-ext-700-normal.4b4022a6.woff +0 -0
  23. package/__mf/font/inter-cyrillic-ext-700-normal.74b516d2.woff2 +0 -0
  24. package/__mf/font/inter-cyrillic-ext-900-normal.9970ddb5.woff +0 -0
  25. package/__mf/font/inter-cyrillic-ext-900-normal.a0d59adc.woff2 +0 -0
  26. package/__mf/font/inter-greek-300-normal.0d7be683.woff2 +0 -0
  27. package/__mf/font/inter-greek-300-normal.8f0b988e.woff +0 -0
  28. package/__mf/font/inter-greek-400-normal.cc58c11b.woff +0 -0
  29. package/__mf/font/inter-greek-400-normal.d7020e3c.woff2 +0 -0
  30. package/__mf/font/inter-greek-500-normal.d9a33207.woff +0 -0
  31. package/__mf/font/inter-greek-500-normal.f41f43db.woff2 +0 -0
  32. package/__mf/font/inter-greek-600-normal.4ec0c1c1.woff +0 -0
  33. package/__mf/font/inter-greek-600-normal.cc532937.woff2 +0 -0
  34. package/__mf/font/inter-greek-700-normal.5ec6c758.woff +0 -0
  35. package/__mf/font/inter-greek-700-normal.97f0eeeb.woff2 +0 -0
  36. package/__mf/font/inter-greek-900-normal.46b66369.woff2 +0 -0
  37. package/__mf/font/inter-greek-900-normal.9ae3a3c5.woff +0 -0
  38. package/__mf/font/inter-greek-ext-300-normal.10247a66.woff2 +0 -0
  39. package/__mf/font/inter-greek-ext-300-normal.4668e5cb.woff +0 -0
  40. package/__mf/font/inter-greek-ext-400-normal.4ce1df5d.woff2 +0 -0
  41. package/__mf/font/inter-greek-ext-400-normal.88ede1ea.woff +0 -0
  42. package/__mf/font/inter-greek-ext-500-normal.7a4aa726.woff +0 -0
  43. package/__mf/font/inter-greek-ext-500-normal.cbd51e2d.woff2 +0 -0
  44. package/__mf/font/inter-greek-ext-600-normal.089a95ee.woff +0 -0
  45. package/__mf/font/inter-greek-ext-600-normal.1f33d317.woff2 +0 -0
  46. package/__mf/font/inter-greek-ext-700-normal.31f1075d.woff +0 -0
  47. package/__mf/font/inter-greek-ext-700-normal.827cd618.woff2 +0 -0
  48. package/__mf/font/inter-greek-ext-900-normal.531bcee7.woff +0 -0
  49. package/__mf/font/inter-greek-ext-900-normal.8a9b36b9.woff2 +0 -0
  50. package/__mf/font/inter-latin-300-normal.15fb600d.woff2 +0 -0
  51. package/__mf/font/inter-latin-300-normal.6f95f590.woff +0 -0
  52. package/__mf/font/inter-latin-400-normal.2c7a775c.woff +0 -0
  53. package/__mf/font/inter-latin-400-normal.ef6d3f52.woff2 +0 -0
  54. package/__mf/font/inter-latin-500-normal.b7b43ace.woff2 +0 -0
  55. package/__mf/font/inter-latin-500-normal.cb4c8ceb.woff +0 -0
  56. package/__mf/font/inter-latin-600-normal.8fb1a964.woff2 +0 -0
  57. package/__mf/font/inter-latin-600-normal.ce0f5f43.woff +0 -0
  58. package/__mf/font/inter-latin-700-normal.953b7aa5.woff2 +0 -0
  59. package/__mf/font/inter-latin-700-normal.9c21d4dc.woff +0 -0
  60. package/__mf/font/inter-latin-900-normal.2a8028ec.woff2 +0 -0
  61. package/__mf/font/inter-latin-900-normal.fa252135.woff +0 -0
  62. package/__mf/font/inter-latin-ext-300-normal.167cc8c9.woff2 +0 -0
  63. package/__mf/font/inter-latin-ext-300-normal.f695be66.woff +0 -0
  64. package/__mf/font/inter-latin-ext-400-normal.32a25442.woff2 +0 -0
  65. package/__mf/font/inter-latin-ext-400-normal.4edcaace.woff +0 -0
  66. package/__mf/font/inter-latin-ext-500-normal.a19a84a6.woff +0 -0
  67. package/__mf/font/inter-latin-ext-500-normal.d9b491de.woff2 +0 -0
  68. package/__mf/font/inter-latin-ext-600-normal.38b075d8.woff2 +0 -0
  69. package/__mf/font/inter-latin-ext-600-normal.49faa47a.woff +0 -0
  70. package/__mf/font/inter-latin-ext-700-normal.93534b50.woff +0 -0
  71. package/__mf/font/inter-latin-ext-700-normal.b63daa1a.woff2 +0 -0
  72. package/__mf/font/inter-latin-ext-900-normal.0efdb307.woff +0 -0
  73. package/__mf/font/inter-latin-ext-900-normal.9c0fc2c7.woff2 +0 -0
  74. package/__mf/font/inter-vietnamese-300-normal.aad496d8.woff +0 -0
  75. package/__mf/font/inter-vietnamese-300-normal.ad9ef503.woff2 +0 -0
  76. package/__mf/font/inter-vietnamese-400-normal.a9dd2faf.woff +0 -0
  77. package/__mf/font/inter-vietnamese-400-normal.de4fc44f.woff2 +0 -0
  78. package/__mf/font/inter-vietnamese-500-normal.7c0a695f.woff2 +0 -0
  79. package/__mf/font/inter-vietnamese-500-normal.a3a73b95.woff +0 -0
  80. package/__mf/font/inter-vietnamese-600-normal.9d518599.woff2 +0 -0
  81. package/__mf/font/inter-vietnamese-600-normal.c5ce3fcb.woff +0 -0
  82. package/__mf/font/inter-vietnamese-700-normal.bc68b199.woff +0 -0
  83. package/__mf/font/inter-vietnamese-700-normal.faf12809.woff2 +0 -0
  84. package/__mf/font/inter-vietnamese-900-normal.2b782045.woff +0 -0
  85. package/__mf/font/inter-vietnamese-900-normal.e639b65a.woff2 +0 -0
  86. package/__mf/js/Table.5ec41996.js +7 -0
  87. package/__mf/js/async/1432.47ca9bc7.js +1 -0
  88. package/__mf/js/async/1519.446ee3b5.js +1 -0
  89. package/__mf/js/async/1616.29b0085e.js +1 -0
  90. package/__mf/js/async/1805.b4a1e768.js +1 -0
  91. package/__mf/js/async/2043.0b0ffaef.js +2 -0
  92. package/__mf/js/async/2082.c0b3db38.js +1 -0
  93. package/__mf/js/async/256.7929d7f5.js +1 -0
  94. package/__mf/js/async/2842.cee1ed42.js +1 -0
  95. package/__mf/js/async/392.eef36bcd.js +2 -0
  96. package/__mf/js/async/4121.403fdade.js +2 -0
  97. package/__mf/js/async/4320.5cbfbd1c.js +1 -0
  98. package/__mf/js/async/5002.fd6ad994.js +1 -0
  99. package/__mf/js/async/5071.1684b9fd.js +1 -0
  100. package/__mf/js/async/5183.acc536f9.js +22 -0
  101. package/__mf/js/async/5286.1b3a5a62.js +7 -0
  102. package/__mf/js/async/{550.8bab52fc.js.LICENSE.txt → 5286.1b3a5a62.js.LICENSE.txt} +19 -1
  103. package/__mf/js/async/5587.966d92d2.js +1 -0
  104. package/__mf/js/async/6274.71776a1d.js +2 -0
  105. package/__mf/js/async/6753.5632301a.js +1 -0
  106. package/__mf/js/async/6811.6a011de7.js +38 -0
  107. package/__mf/js/async/7177.f0c1cf85.js +1 -0
  108. package/__mf/js/async/7192.f9d57dbb.js +1 -0
  109. package/__mf/js/async/7413.a78d135c.js +1 -0
  110. package/__mf/js/async/7862.de8ef786.js +2 -0
  111. package/__mf/js/async/7968.545aab42.js +1 -0
  112. package/__mf/js/async/7978.61f7fc2d.js +1 -0
  113. package/__mf/js/async/8356.7a060c2c.js +1 -0
  114. package/__mf/js/async/8470.dac32d6a.js +2 -0
  115. package/__mf/js/async/868.a08b9f5f.js +110 -0
  116. package/__mf/js/async/{868.9f710584.js.LICENSE.txt → 868.a08b9f5f.js.LICENSE.txt} +1 -1
  117. package/__mf/js/async/873.bb80627c.js +1 -0
  118. package/__mf/js/async/8750.8dc0b93d.js +3 -0
  119. package/__mf/js/async/9051.2db4f8e5.js +1 -0
  120. package/__mf/js/async/9235.35b8884a.js +1 -0
  121. package/__mf/js/async/941.97799379.js +2 -0
  122. package/__mf/js/async/9546.f3c1cf02.js +2 -0
  123. package/__mf/js/async/{1117.b21b0ae4.js.LICENSE.txt → 9546.f3c1cf02.js.LICENSE.txt} +1 -1
  124. package/__mf/js/async/9588.178c0b3f.js +1 -0
  125. package/__mf/js/async/9701.4ae63d2f.js +1 -0
  126. package/__mf/js/async/__federation_expose_Table.7060f62e.js +1 -0
  127. package/__mf/js/async/lib-router.96861d20.js +2 -0
  128. package/__mf/js/main.8677f3d2.js +7 -0
  129. package/lib/TableExportAction.d.ts +1 -1
  130. package/lib/TableExportAction.d.ts.map +1 -1
  131. package/lib/TableExportAction.js +1 -2
  132. package/lib/TableExportAction.js.map +1 -1
  133. package/lib/cjs/TableExportAction.js +1 -2
  134. package/lib/cjs/components/ColumnsEditor/ColumnEditor.js +60 -22
  135. package/lib/cjs/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +124 -0
  136. package/lib/cjs/components/TablePanel.js +201 -11
  137. package/lib/cjs/models/table-model.js +32 -6
  138. package/lib/components/ColumnsEditor/ColumnEditor.d.ts.map +1 -1
  139. package/lib/components/ColumnsEditor/ColumnEditor.js +61 -23
  140. package/lib/components/ColumnsEditor/ColumnEditor.js.map +1 -1
  141. package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts +13 -0
  142. package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts.map +1 -0
  143. package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +114 -0
  144. package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js.map +1 -0
  145. package/lib/components/EmbeddedPanel.d.ts +1 -1
  146. package/lib/components/EmbeddedPanel.d.ts.map +1 -1
  147. package/lib/components/EmbeddedPanel.js.map +1 -1
  148. package/lib/components/TablePanel.d.ts +1 -1
  149. package/lib/components/TablePanel.d.ts.map +1 -1
  150. package/lib/components/TablePanel.js +201 -11
  151. package/lib/components/TablePanel.js.map +1 -1
  152. package/lib/components/TableTransformsEditor.d.ts.map +1 -1
  153. package/lib/components/TableTransformsEditor.js.map +1 -1
  154. package/lib/models/table-model.d.ts +2 -2
  155. package/lib/models/table-model.d.ts.map +1 -1
  156. package/lib/models/table-model.js +32 -6
  157. package/lib/models/table-model.js.map +1 -1
  158. package/lib/table-data-utils.d.ts +1 -1
  159. package/lib/table-data-utils.d.ts.map +1 -1
  160. package/lib/table-data-utils.js.map +1 -1
  161. package/lib/test/mock-query-results.d.ts +1 -1
  162. package/lib/test/mock-query-results.js.map +1 -1
  163. package/mf-manifest.json +94 -75
  164. package/mf-stats.json +109 -78
  165. package/package.json +5 -5
  166. package/__mf/css/async/3061.d3010b86.css +0 -1
  167. package/__mf/css/async/5442.d3010b86.css +0 -1
  168. package/__mf/css/async/7823.d3010b86.css +0 -1
  169. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  170. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  171. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  172. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  173. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  174. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  175. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  176. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  177. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  178. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  179. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  180. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  181. package/__mf/js/Table.e34e0ae1.js +0 -6
  182. package/__mf/js/async/1103.ffbc2bec.js +0 -1
  183. package/__mf/js/async/1117.b21b0ae4.js +0 -2
  184. package/__mf/js/async/1432.acd0ad59.js +0 -1
  185. package/__mf/js/async/1616.7a74f4ef.js +0 -1
  186. package/__mf/js/async/2043.fdebf89c.js +0 -2
  187. package/__mf/js/async/208.2b17c08c.js +0 -3
  188. package/__mf/js/async/2082.78532c3c.js +0 -1
  189. package/__mf/js/async/272.3bc7825c.js +0 -1
  190. package/__mf/js/async/392.49e51fc5.js +0 -2
  191. package/__mf/js/async/4121.8e97ef88.js +0 -2
  192. package/__mf/js/async/5002.3189d214.js +0 -1
  193. package/__mf/js/async/5019.5318688a.js +0 -1
  194. package/__mf/js/async/5071.91e1c002.js +0 -1
  195. package/__mf/js/async/54.8b007a26.js +0 -22
  196. package/__mf/js/async/550.8bab52fc.js +0 -7
  197. package/__mf/js/async/5587.f5f2b0cc.js +0 -1
  198. package/__mf/js/async/6274.14683c28.js +0 -2
  199. package/__mf/js/async/6283.e044c368.js +0 -2
  200. package/__mf/js/async/6753.032ce611.js +0 -1
  201. package/__mf/js/async/6811.4e18bc66.js +0 -38
  202. package/__mf/js/async/7177.356298ae.js +0 -1
  203. package/__mf/js/async/7192.66c9e3a5.js +0 -1
  204. package/__mf/js/async/7968.a66bfadb.js +0 -1
  205. package/__mf/js/async/7978.a19f5a4f.js +0 -1
  206. package/__mf/js/async/8356.8ae40b6a.js +0 -1
  207. package/__mf/js/async/8470.1b8b20ff.js +0 -2
  208. package/__mf/js/async/868.9f710584.js +0 -110
  209. package/__mf/js/async/873.a7310675.js +0 -1
  210. package/__mf/js/async/9051.e3054e02.js +0 -1
  211. package/__mf/js/async/9235.eee50e10.js +0 -1
  212. package/__mf/js/async/941.333875f4.js +0 -2
  213. package/__mf/js/async/9588.7b021071.js +0 -1
  214. package/__mf/js/async/9701.3b068d23.js +0 -1
  215. package/__mf/js/async/__federation_expose_Table.894a962f.js +0 -1
  216. package/__mf/js/async/lib-router.2e1dec85.js +0 -2
  217. package/__mf/js/main.5b8b137b.js +0 -6
  218. /package/__mf/js/async/{2043.fdebf89c.js.LICENSE.txt → 2043.0b0ffaef.js.LICENSE.txt} +0 -0
  219. /package/__mf/js/async/{392.49e51fc5.js.LICENSE.txt → 392.eef36bcd.js.LICENSE.txt} +0 -0
  220. /package/__mf/js/async/{4121.8e97ef88.js.LICENSE.txt → 4121.403fdade.js.LICENSE.txt} +0 -0
  221. /package/__mf/js/async/{54.8b007a26.js.LICENSE.txt → 5183.acc536f9.js.LICENSE.txt} +0 -0
  222. /package/__mf/js/async/{6274.14683c28.js.LICENSE.txt → 6274.71776a1d.js.LICENSE.txt} +0 -0
  223. /package/__mf/js/async/{6283.e044c368.js.LICENSE.txt → 7862.de8ef786.js.LICENSE.txt} +0 -0
  224. /package/__mf/js/async/{8470.1b8b20ff.js.LICENSE.txt → 8470.dac32d6a.js.LICENSE.txt} +0 -0
  225. /package/__mf/js/async/{941.333875f4.js.LICENSE.txt → 941.97799379.js.LICENSE.txt} +0 -0
  226. /package/__mf/js/async/{lib-router.2e1dec85.js.LICENSE.txt → lib-router.96861d20.js.LICENSE.txt} +0 -0
@@ -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
+ }
@@ -31,19 +31,163 @@ _export(exports, {
31
31
  const _jsxruntime = require("react/jsx-runtime");
32
32
  const _material = require("@mui/material");
33
33
  const _components = require("@perses-dev/components");
34
- const _core = require("@perses-dev/core");
35
34
  const _dashboards = require("@perses-dev/dashboards");
36
35
  const _pluginsystem = require("@perses-dev/plugin-system");
37
36
  const _react = require("react");
38
37
  const _models = require("../models");
39
38
  const _tabledatautils = require("../table-data-utils");
40
39
  const _EmbeddedPanel = require("./EmbeddedPanel");
41
- function generateCellContentConfig(column) {
40
+ function parseNumericCellValue(value) {
41
+ if (typeof value === 'number' && Number.isFinite(value)) {
42
+ return value;
43
+ }
44
+ if (typeof value === 'string') {
45
+ const parsed = Number(value);
46
+ if (Number.isFinite(parsed)) {
47
+ return parsed;
48
+ }
49
+ }
50
+ return undefined;
51
+ }
52
+ function isPanelData(value) {
53
+ if (typeof value !== 'object' || value === null) {
54
+ return false;
55
+ }
56
+ const candidate = value;
57
+ return candidate.definition !== undefined && candidate.data !== undefined;
58
+ }
59
+ function createSyntheticPanelData(value, columnName) {
60
+ const numericValue = parseNumericCellValue(value);
61
+ if (numericValue === undefined) {
62
+ return undefined;
63
+ }
64
+ const now = Date.now();
65
+ return {
66
+ definition: {
67
+ kind: 'TimeSeriesQuery',
68
+ spec: {
69
+ plugin: {
70
+ kind: 'PrometheusTimeSeriesQuery',
71
+ spec: {
72
+ query: ''
73
+ }
74
+ }
75
+ }
76
+ },
77
+ data: {
78
+ timeRange: {
79
+ start: new Date(now),
80
+ end: new Date(now)
81
+ },
82
+ stepMs: 1,
83
+ series: [
84
+ {
85
+ name: columnName,
86
+ values: [
87
+ [
88
+ now,
89
+ numericValue
90
+ ]
91
+ ],
92
+ labels: {}
93
+ }
94
+ ]
95
+ }
96
+ };
97
+ }
98
+ function getGaugeNumericValue(value) {
99
+ if (isPanelData(value)) {
100
+ const series = value.data?.series;
101
+ const firstSeries = series?.[0];
102
+ if (!firstSeries?.values?.length) {
103
+ return undefined;
104
+ }
105
+ const calc = _pluginsystem.CalculationsMap['last-number'];
106
+ if (typeof calc !== 'function') {
107
+ return undefined;
108
+ }
109
+ const calculatedValue = calc(firstSeries.values);
110
+ return typeof calculatedValue === 'number' ? calculatedValue : undefined;
111
+ }
112
+ return parseNumericCellValue(value);
113
+ }
114
+ function InlineGaugeCellWithRange({ value, range, fillColor, format }) {
115
+ if (value === undefined) {
116
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {});
117
+ }
118
+ let percent = 0;
119
+ if (range !== undefined) {
120
+ if (range.max === range.min) {
121
+ percent = 100;
122
+ } else {
123
+ percent = (value - range.min) / (range.max - range.min) * 100;
124
+ }
125
+ }
126
+ percent = Math.max(0, Math.min(100, percent));
127
+ const trackColor = 'rgba(127,127,127,0.20)';
128
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
129
+ sx: {
130
+ display: 'flex',
131
+ alignItems: 'center',
132
+ width: '100%',
133
+ gap: 1
134
+ },
135
+ children: [
136
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
137
+ sx: {
138
+ flexGrow: 1,
139
+ borderRadius: 1,
140
+ backgroundColor: trackColor,
141
+ height: 24,
142
+ overflow: 'hidden'
143
+ },
144
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
145
+ sx: {
146
+ width: `${percent}%`,
147
+ height: '100%',
148
+ backgroundColor: fillColor ?? 'success.main',
149
+ borderRadius: 1
150
+ }
151
+ })
152
+ }),
153
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
154
+ variant: "body2",
155
+ sx: {
156
+ minWidth: 52,
157
+ textAlign: 'right'
158
+ },
159
+ children: format ? (0, _components.formatValue)(value, format) : value.toFixed(2)
160
+ })
161
+ ]
162
+ });
163
+ }
164
+ function resolveGaugeFillColor(value, globalCellSettings, columnCellSettings) {
165
+ let cellConfig = (0, _models.evaluateConditionalFormatting)(value, globalCellSettings);
166
+ if (columnCellSettings?.length) {
167
+ const columnCellConfig = (0, _models.evaluateConditionalFormatting)(value, columnCellSettings);
168
+ if (columnCellConfig) {
169
+ cellConfig = columnCellConfig;
170
+ }
171
+ }
172
+ return cellConfig?.backgroundColor ?? cellConfig?.textColor;
173
+ }
174
+ function generateCellContentConfig(column, gaugeRange, globalCellSettings = []) {
42
175
  const plugin = column.plugin;
43
176
  if (plugin !== undefined) {
44
177
  return {
45
178
  cell: (ctx)=>{
46
- const panelData = ctx.getValue();
179
+ const cellValue = ctx.getValue();
180
+ if (plugin.kind === 'GaugeChart') {
181
+ const gaugeValue = getGaugeNumericValue(cellValue);
182
+ const gaugeFillColor = resolveGaugeFillColor(gaugeValue, globalCellSettings, column.cellSettings);
183
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(InlineGaugeCellWithRange, {
184
+ value: gaugeValue,
185
+ range: gaugeRange,
186
+ fillColor: gaugeFillColor,
187
+ format: plugin.spec?.format ?? column.format
188
+ });
189
+ }
190
+ const panelData = isPanelData(cellValue) ? cellValue : createSyntheticPanelData(cellValue, column.name);
47
191
  if (!panelData) return /*#__PURE__*/ (0, _jsxruntime.jsx)(_jsxruntime.Fragment, {});
48
192
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_EmbeddedPanel.EmbeddedPanel, {
49
193
  kind: plugin.kind,
@@ -59,15 +203,17 @@ function generateCellContentConfig(column) {
59
203
  return {
60
204
  cell: (ctx)=>{
61
205
  const cellValue = ctx.getValue();
62
- return typeof cellValue === 'number' && column.format ? (0, _core.formatValue)(cellValue, column.format) : cellValue;
206
+ return typeof cellValue === 'number' && column.format ? (0, _components.formatValue)(cellValue, column.format) : cellValue;
63
207
  },
64
208
  cellDescription: column.cellDescription ? ()=>`${column.cellDescription}` : undefined
65
209
  };
66
210
  }
67
211
  function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme }) {
212
+ const [searchTerm, setSearchTerm] = (0, _react.useState)('');
68
213
  const values = [
69
214
  ...new Set(allValues)
70
215
  ].filter((v)=>v !== null).sort();
216
+ const filteredValues = searchTerm ? values.filter((v)=>String(v).toLowerCase().includes(searchTerm.toLowerCase())) : values;
71
217
  if (values.length === 0) {
72
218
  return /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
73
219
  "data-filter-dropdown": true,
@@ -101,6 +247,23 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
101
247
  overflowY: 'auto'
102
248
  },
103
249
  children: [
250
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("input", {
251
+ type: "text",
252
+ placeholder: "Search...",
253
+ value: searchTerm,
254
+ onChange: (e)=>setSearchTerm(e.target.value),
255
+ style: {
256
+ width: '100%',
257
+ padding: '6px 8px',
258
+ marginBottom: 8,
259
+ fontSize: 13,
260
+ border: `1px solid ${theme.palette.divider}`,
261
+ borderRadius: 4,
262
+ backgroundColor: theme.palette.background.default,
263
+ color: theme.palette.text.primary,
264
+ boxSizing: 'border-box'
265
+ }
266
+ }),
104
267
  /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
105
268
  style: {
106
269
  marginBottom: 8,
@@ -142,7 +305,7 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
142
305
  borderTop: `1px solid ${theme.palette.divider}`
143
306
  }
144
307
  }),
145
- values.map((value, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
308
+ filteredValues.map((value, index)=>/*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
146
309
  style: {
147
310
  marginBottom: 4
148
311
  },
@@ -195,7 +358,7 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
195
358
  * Generate column config from column definitions, if a column has multiple definitions, the first one will be used.
196
359
  * If column is hidden, return undefined.
197
360
  * If column do not have a definition, return a default column config.
198
- */ function generateColumnConfig(name, columnSettings, allVariables) {
361
+ */ function generateColumnConfig(name, columnSettings, allVariables, gaugeRangeByColumn, globalCellSettings = []) {
199
362
  for (const column of columnSettings){
200
363
  if (column.name === name) {
201
364
  if (column.hide) {
@@ -214,7 +377,7 @@ function ColumnFilterDropdown({ allValues, selectedValues, onFilterChange, theme
214
377
  width,
215
378
  align,
216
379
  dataLink: modifiedDataLink,
217
- ...generateCellContentConfig(column)
380
+ ...generateCellContentConfig(column, gaugeRangeByColumn[name], globalCellSettings)
218
381
  };
219
382
  }
220
383
  }
@@ -282,7 +445,7 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
282
445
  spec
283
446
  ]);
284
447
  // Transform will be applied by their orders on the original data
285
- const data = (0, _react.useMemo)(()=>(0, _core.transformData)(rawData, spec.transforms ?? []), [
448
+ const data = (0, _react.useMemo)(()=>(0, _components.transformData)(rawData, spec.transforms ?? []), [
286
449
  rawData,
287
450
  spec.transforms
288
451
  ]);
@@ -311,6 +474,31 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
311
474
  data,
312
475
  keys
313
476
  ]);
477
+ const gaugeRangeByColumn = (0, _react.useMemo)(()=>{
478
+ const result = {};
479
+ for (const key of keys){
480
+ let min = Number.POSITIVE_INFINITY;
481
+ let max = Number.NEGATIVE_INFINITY;
482
+ for (const row of data){
483
+ const numericValue = getGaugeNumericValue(row[key]);
484
+ if (numericValue === undefined) {
485
+ continue;
486
+ }
487
+ min = Math.min(min, numericValue);
488
+ max = Math.max(max, numericValue);
489
+ }
490
+ if (min !== Number.POSITIVE_INFINITY && max !== Number.NEGATIVE_INFINITY) {
491
+ result[key] = {
492
+ min,
493
+ max
494
+ };
495
+ }
496
+ }
497
+ return result;
498
+ }, [
499
+ data,
500
+ keys
501
+ ]);
314
502
  // Generate columns and map each column accessor to its settings index and data key
315
503
  const columns = (0, _react.useMemo)(()=>{
316
504
  const columns = [];
@@ -318,7 +506,7 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
318
506
  // Process columnSettings if they exist
319
507
  for (const columnSetting of spec.columnSettings ?? []){
320
508
  if (customizedColumns.has(columnSetting.name)) continue; // Skip duplicates
321
- const columnConfig = generateColumnConfig(columnSetting.name, spec.columnSettings ?? [], allVariables);
509
+ const columnConfig = generateColumnConfig(columnSetting.name, spec.columnSettings ?? [], allVariables, gaugeRangeByColumn, spec.cellSettings ?? []);
322
510
  if (columnConfig !== undefined) {
323
511
  columns.push(columnConfig);
324
512
  customizedColumns.add(columnSetting.name);
@@ -328,7 +516,7 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
328
516
  if (!spec.defaultColumnHidden) {
329
517
  for (const key of keys){
330
518
  if (!customizedColumns.has(key)) {
331
- const columnConfig = generateColumnConfig(key, spec.columnSettings ?? [], allVariables);
519
+ const columnConfig = generateColumnConfig(key, spec.columnSettings ?? [], allVariables, gaugeRangeByColumn, spec.cellSettings ?? []);
332
520
  if (columnConfig !== undefined) {
333
521
  columns.push(columnConfig);
334
522
  }
@@ -340,7 +528,9 @@ function TablePanel({ contentDimensions, spec, queryResults }) {
340
528
  keys,
341
529
  spec.columnSettings,
342
530
  spec.defaultColumnHidden,
343
- allVariables
531
+ allVariables,
532
+ gaugeRangeByColumn,
533
+ spec.cellSettings
344
534
  ]);
345
535
  // Generate cell settings that will be used by the table to render cells (text color, background color, ...)
346
536
  const cellConfigs = (0, _react.useMemo)(()=>{
@@ -50,6 +50,14 @@ function createInitialTableOptions() {
50
50
  enableFiltering: true
51
51
  };
52
52
  }
53
+ function parseRangeBound(rawValue) {
54
+ const trimmed = rawValue.trim();
55
+ if (trimmed === '') {
56
+ return undefined;
57
+ }
58
+ const parsed = Number(trimmed);
59
+ return Number.isNaN(parsed) ? undefined : parsed;
60
+ }
53
61
  function formatCellDisplay(value, setting, defaultText) {
54
62
  const baseText = setting.text || defaultText || String(value);
55
63
  const displayText = `${setting.prefix ?? ''}${baseText}${setting.suffix ?? ''}`;
@@ -153,13 +161,22 @@ function renderConditionEditor(condition, onChange, size = 'small') {
153
161
  label: 'From',
154
162
  placeholder: 'Start of range',
155
163
  value: condition.spec?.min ?? '',
156
- onChange: (e)=>onChange({
164
+ onChange: (e)=>{
165
+ const nextMin = parseRangeBound(e.target.value);
166
+ onChange({
157
167
  ...condition,
158
168
  spec: {
159
169
  ...condition.spec,
160
- min: +e.target.value
170
+ min: nextMin
161
171
  }
162
- }),
172
+ });
173
+ },
174
+ type: 'number',
175
+ slotProps: {
176
+ htmlInput: {
177
+ step: 'any'
178
+ }
179
+ },
163
180
  fullWidth: true,
164
181
  size: size
165
182
  }),
@@ -168,13 +185,22 @@ function renderConditionEditor(condition, onChange, size = 'small') {
168
185
  label: 'To',
169
186
  placeholder: 'End of range (inclusive)',
170
187
  value: condition.spec?.max ?? '',
171
- onChange: (e)=>onChange({
188
+ onChange: (e)=>{
189
+ const nextMax = parseRangeBound(e.target.value);
190
+ onChange({
172
191
  ...condition,
173
192
  spec: {
174
193
  ...condition.spec,
175
- max: +e.target.value
194
+ max: nextMax
176
195
  }
177
- }),
196
+ });
197
+ },
198
+ type: 'number',
199
+ slotProps: {
200
+ htmlInput: {
201
+ step: 'any'
202
+ }
203
+ },
178
204
  fullWidth: true,
179
205
  size: size
180
206
  })
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ColumnsEditor/ColumnEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA8B,UAAU,EAAqB,MAAM,eAAe,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAa/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAS9C,KAAK,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC;IAC1E,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,iBAAiB,GAAG,YAAY,CAuL7F"}
1
+ {"version":3,"file":"ColumnEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/ColumnsEditor/ColumnEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAA8B,UAAU,EAAiC,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAa/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAU9C,KAAK,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAEzD,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC;IAC1E,MAAM,EAAE,cAAc,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,EAAE,iBAAiB,GAAG,YAAY,CA8M7F"}
@@ -11,12 +11,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
- import { Button, ButtonGroup, Stack, Switch, TextField } from '@mui/material';
14
+ import { Button, ButtonGroup, Stack, Switch, TextField, Typography } from '@mui/material';
15
15
  import { useState } from 'react';
16
16
  import { AlignSelector, FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, SortSelectorButtons } from '@perses-dev/components';
17
17
  import { PluginKindSelect } from '@perses-dev/plugin-system';
18
18
  import { ConditionalPanel } from '../ConditionalPanel';
19
19
  import { DataLinkEditor } from './DataLinkEditorDialog';
20
+ import { EmbeddedPanelOptionsEditor } from './EmbeddedPanelOptionsEditor';
20
21
  const DEFAULT_FORMAT = {
21
22
  unit: 'decimal',
22
23
  shortValues: true
@@ -115,39 +116,53 @@ export function ColumnEditor({ column, onChange, ...others }) {
115
116
  })
116
117
  }),
117
118
  /*#__PURE__*/ _jsx(OptionsEditorControl, {
118
- label: "Display",
119
- control: /*#__PURE__*/ _jsxs(ButtonGroup, {
120
- "aria-label": "Display",
121
- size: "small",
119
+ label: "Cell display",
120
+ control: /*#__PURE__*/ _jsxs(Stack, {
121
+ spacing: 1,
122
122
  children: [
123
- /*#__PURE__*/ _jsx(Button, {
124
- variant: !column.plugin ? 'contained' : 'outlined',
125
- onClick: ()=>onChange({
126
- ...column,
127
- plugin: undefined
123
+ /*#__PURE__*/ _jsxs(ButtonGroup, {
124
+ "aria-label": "Cell display",
125
+ size: "small",
126
+ children: [
127
+ /*#__PURE__*/ _jsx(Button, {
128
+ variant: !column.plugin ? 'contained' : 'outlined',
129
+ onClick: ()=>onChange({
130
+ ...column,
131
+ plugin: undefined
132
+ }),
133
+ children: "Text"
128
134
  }),
129
- children: "Text"
135
+ /*#__PURE__*/ _jsx(Button, {
136
+ variant: column.plugin ? 'contained' : 'outlined',
137
+ onClick: ()=>onChange({
138
+ ...column,
139
+ plugin: {
140
+ kind: 'GaugeChart',
141
+ spec: {}
142
+ }
143
+ }),
144
+ children: "Visualization"
145
+ })
146
+ ]
130
147
  }),
131
- /*#__PURE__*/ _jsx(Button, {
132
- variant: column.plugin ? 'contained' : 'outlined',
133
- onClick: ()=>onChange({
134
- ...column,
135
- plugin: {
136
- kind: 'StatChart',
137
- spec: {}
138
- }
139
- }),
140
- children: "Embedded Panel"
148
+ /*#__PURE__*/ _jsx(Typography, {
149
+ variant: "caption",
150
+ color: "text.secondary",
151
+ sx: {
152
+ maxWidth: 360
153
+ },
154
+ children: "Visualizations reuse panel settings (thresholds, units, colors). Text mode uses value formatting below."
141
155
  })
142
156
  ]
143
157
  })
144
158
  }),
145
159
  column.plugin ? /*#__PURE__*/ _jsx(OptionsEditorControl, {
146
- label: "Panel Type",
160
+ label: "Visualization type",
147
161
  control: /*#__PURE__*/ _jsx(PluginKindSelect, {
148
162
  pluginTypes: [
149
163
  'Panel'
150
164
  ],
165
+ size: "small",
151
166
  value: {
152
167
  type: 'Panel',
153
168
  kind: column.plugin.kind
@@ -221,9 +236,32 @@ export function ColumnEditor({ column, onChange, ...others }) {
221
236
  })
222
237
  ]
223
238
  }),
239
+ column.plugin?.kind === 'GaugeChart' && /*#__PURE__*/ _jsx(Stack, {
240
+ sx: {
241
+ px: 8,
242
+ mt: 4,
243
+ width: '100%'
244
+ },
245
+ spacing: 2,
246
+ children: /*#__PURE__*/ _jsx(OptionsEditorGroup, {
247
+ title: "Visualization settings",
248
+ children: /*#__PURE__*/ _jsx(EmbeddedPanelOptionsEditor, {
249
+ kind: "GaugeChart",
250
+ spec: column.plugin.spec,
251
+ onChange: (nextSpec)=>onChange({
252
+ ...column,
253
+ plugin: {
254
+ kind: 'GaugeChart',
255
+ spec: nextSpec
256
+ }
257
+ })
258
+ })
259
+ })
260
+ }),
224
261
  /*#__PURE__*/ _jsx(Stack, {
225
262
  sx: {
226
- px: 8
263
+ px: 8,
264
+ mt: column.plugin?.kind === 'GaugeChart' ? 3 : 0
227
265
  },
228
266
  children: /*#__PURE__*/ _jsx(OptionsEditorGroup, {
229
267
  title: "Conditional Cell Format",