@perses-dev/table-plugin 0.13.0 → 0.14.0-beta.1

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 (211) hide show
  1. package/__mf/js/{Table.73b9cec1.js → Table.646f97de.js} +3 -3
  2. package/__mf/js/async/11.976870d0.js +7 -0
  3. package/__mf/js/async/11.976870d0.js.LICENSE.txt +102 -0
  4. package/__mf/js/async/121.b3a4c6cf.js +2 -0
  5. package/__mf/js/async/153.fa68a9e4.js +1 -0
  6. package/__mf/js/async/186.ab1e0cb3.js +2 -0
  7. package/__mf/js/async/192.942516a2.js +1 -0
  8. package/__mf/js/async/2.6b27d33f.js +1 -0
  9. package/__mf/js/async/235.c5bac291.js +1 -0
  10. package/__mf/js/async/274.f7dabfa6.js +2 -0
  11. package/__mf/js/async/321.96f362a6.js +1 -0
  12. package/__mf/js/async/35.ba7c1b06.js +1 -0
  13. package/__mf/js/async/356.d7fe5d24.js +1 -0
  14. package/__mf/js/async/392.e853a818.js +2 -0
  15. package/__mf/js/async/413.d44db4b1.js +1 -0
  16. package/__mf/js/async/465.8425c17a.js +1 -0
  17. package/__mf/js/async/470.21434f20.js +2 -0
  18. package/__mf/js/async/522.d6a7c203.js +22 -0
  19. package/__mf/js/async/534.aff242e9.js +1 -0
  20. package/__mf/js/async/54.e77ec040.js +1 -0
  21. package/__mf/js/async/587.0ff26337.js +1 -0
  22. package/__mf/js/async/616.4e891cf9.js +1 -0
  23. package/__mf/js/async/663.b3778d4c.js +1 -0
  24. package/__mf/js/async/700.ccacc909.js +3 -0
  25. package/__mf/js/async/{868.507e984c.js → 741.7feaa0ba.js} +6 -6
  26. package/__mf/js/async/862.4c658639.js +2 -0
  27. package/__mf/js/async/865.b9eb3de4.js +1 -0
  28. package/__mf/js/async/923.87e55609.js +1 -0
  29. package/__mf/js/async/941.08c16cb2.js +2 -0
  30. package/__mf/js/async/968.b7fe9818.js +1 -0
  31. package/__mf/js/async/985.6129a36c.js +37 -0
  32. package/__mf/js/async/__federation_expose_Table.f8d0feb7.js +1 -0
  33. package/__mf/js/async/lib-router.020a2a16.js +2 -0
  34. package/__mf/js/{main.7b15c841.js → main.276cd542.js} +2 -2
  35. package/lib/Table.d.ts +3 -3
  36. package/lib/Table.d.ts.map +1 -1
  37. package/lib/Table.js +4 -4
  38. package/lib/Table.js.map +1 -1
  39. package/lib/TableExportAction.d.ts +3 -3
  40. package/lib/TableExportAction.d.ts.map +1 -1
  41. package/lib/TableExportAction.js +6 -6
  42. package/lib/TableExportAction.js.map +1 -1
  43. package/lib/bootstrap.js +2 -2
  44. package/lib/components/CellsEditor/CellsEditor.d.ts +2 -2
  45. package/lib/components/CellsEditor/CellsEditor.d.ts.map +1 -1
  46. package/lib/components/CellsEditor/CellsEditor.js +1 -1
  47. package/lib/components/CellsEditor/CellsEditor.js.map +1 -1
  48. package/lib/components/CellsEditor/index.js +1 -1
  49. package/lib/components/CellsEditor/index.js.map +1 -1
  50. package/lib/components/ColumnsEditor/ColumnEditor.d.ts +5 -4
  51. package/lib/components/ColumnsEditor/ColumnEditor.d.ts.map +1 -1
  52. package/lib/components/ColumnsEditor/ColumnEditor.js +29 -15
  53. package/lib/components/ColumnsEditor/ColumnEditor.js.map +1 -1
  54. package/lib/components/ColumnsEditor/ColumnEditorContainer.d.ts +3 -3
  55. package/lib/components/ColumnsEditor/ColumnEditorContainer.d.ts.map +1 -1
  56. package/lib/components/ColumnsEditor/ColumnEditorContainer.js +11 -10
  57. package/lib/components/ColumnsEditor/ColumnEditorContainer.js.map +1 -1
  58. package/lib/components/ColumnsEditor/ColumnsEditor.d.ts +4 -3
  59. package/lib/components/ColumnsEditor/ColumnsEditor.d.ts.map +1 -1
  60. package/lib/components/ColumnsEditor/ColumnsEditor.js +7 -6
  61. package/lib/components/ColumnsEditor/ColumnsEditor.js.map +1 -1
  62. package/lib/components/ColumnsEditor/DataLinkEditorDialog.d.ts +2 -2
  63. package/lib/components/ColumnsEditor/DataLinkEditorDialog.d.ts.map +1 -1
  64. package/lib/components/ColumnsEditor/DataLinkEditorDialog.js +4 -4
  65. package/lib/components/ColumnsEditor/DataLinkEditorDialog.js.map +1 -1
  66. package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts +2 -2
  67. package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.d.ts.map +1 -1
  68. package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +4 -4
  69. package/lib/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js.map +1 -1
  70. package/lib/components/ColumnsEditor/index.js +3 -3
  71. package/lib/components/ColumnsEditor/index.js.map +1 -1
  72. package/lib/components/ConditionalPanel.d.ts +3 -3
  73. package/lib/components/ConditionalPanel.d.ts.map +1 -1
  74. package/lib/components/ConditionalPanel.js +7 -7
  75. package/lib/components/ConditionalPanel.js.map +1 -1
  76. package/lib/components/EmbeddedPanel.d.ts +3 -3
  77. package/lib/components/EmbeddedPanel.d.ts.map +1 -1
  78. package/lib/components/EmbeddedPanel.js +4 -4
  79. package/lib/components/EmbeddedPanel.js.map +1 -1
  80. package/lib/components/TableCellsEditor.d.ts +3 -3
  81. package/lib/components/TableCellsEditor.d.ts.map +1 -1
  82. package/lib/components/TableCellsEditor.js +1 -1
  83. package/lib/components/TableCellsEditor.js.map +1 -1
  84. package/lib/components/TableColumnsEditor.d.ts +3 -3
  85. package/lib/components/TableColumnsEditor.d.ts.map +1 -1
  86. package/lib/components/TableColumnsEditor.js +3 -2
  87. package/lib/components/TableColumnsEditor.js.map +1 -1
  88. package/lib/components/TableItemSelectionActionsEditor.d.ts +2 -2
  89. package/lib/components/TableItemSelectionActionsEditor.d.ts.map +1 -1
  90. package/lib/components/TableItemSelectionActionsEditor.js +2 -2
  91. package/lib/components/TableItemSelectionActionsEditor.js.map +1 -1
  92. package/lib/components/TablePanel.d.ts +4 -4
  93. package/lib/components/TablePanel.d.ts.map +1 -1
  94. package/lib/components/TablePanel.js +196 -99
  95. package/lib/components/TablePanel.js.map +1 -1
  96. package/lib/components/TableSettingsEditor.d.ts +2 -2
  97. package/lib/components/TableSettingsEditor.d.ts.map +1 -1
  98. package/lib/components/TableSettingsEditor.js +16 -2
  99. package/lib/components/TableSettingsEditor.js.map +1 -1
  100. package/lib/components/TableTransformsEditor.d.ts +2 -2
  101. package/lib/components/TableTransformsEditor.d.ts.map +1 -1
  102. package/lib/components/TableTransformsEditor.js +2 -2
  103. package/lib/components/TableTransformsEditor.js.map +1 -1
  104. package/lib/components/index.js +9 -9
  105. package/lib/components/index.js.map +1 -1
  106. package/lib/getPluginModule.d.ts +1 -1
  107. package/lib/getPluginModule.d.ts.map +1 -1
  108. package/lib/getPluginModule.js +3 -1
  109. package/lib/getPluginModule.js.map +1 -1
  110. package/lib/index-federation.js +1 -1
  111. package/lib/index.js +4 -4
  112. package/lib/index.js.map +1 -1
  113. package/lib/models/index.js +2 -2
  114. package/lib/models/index.js.map +1 -1
  115. package/lib/models/model.d.ts +1 -1
  116. package/lib/models/model.d.ts.map +1 -1
  117. package/lib/models/model.js.map +1 -1
  118. package/lib/models/table-model.d.ts +4 -3
  119. package/lib/models/table-model.d.ts.map +1 -1
  120. package/lib/models/table-model.js +2 -2
  121. package/lib/models/table-model.js.map +1 -1
  122. package/lib/setup-tests.d.ts +1 -1
  123. package/lib/setup-tests.d.ts.map +1 -1
  124. package/lib/setup-tests.js +8 -2
  125. package/lib/setup-tests.js.map +1 -1
  126. package/lib/table-data-utils.d.ts +3 -3
  127. package/lib/table-data-utils.d.ts.map +1 -1
  128. package/lib/table-data-utils.js.map +1 -1
  129. package/lib/test/mock-query-results.d.ts +1 -1
  130. package/lib/test/mock-query-results.d.ts.map +1 -1
  131. package/lib/test/mock-query-results.js.map +1 -1
  132. package/mf-manifest.json +42 -84
  133. package/mf-stats.json +46 -93
  134. package/package.json +11 -11
  135. package/__mf/js/async/1432.4e515509.js +0 -1
  136. package/__mf/js/async/1589.124ce93d.js +0 -2
  137. package/__mf/js/async/1589.124ce93d.js.LICENSE.txt +0 -37
  138. package/__mf/js/async/1616.4828085d.js +0 -1
  139. package/__mf/js/async/2043.1f09864b.js +0 -2
  140. package/__mf/js/async/2043.1f09864b.js.LICENSE.txt +0 -24
  141. package/__mf/js/async/2082.231e8397.js +0 -1
  142. package/__mf/js/async/2842.a52597e6.js +0 -1
  143. package/__mf/js/async/392.b6035b41.js +0 -2
  144. package/__mf/js/async/3981.52e94742.js +0 -3
  145. package/__mf/js/async/4014.cf88a118.js +0 -7
  146. package/__mf/js/async/4014.cf88a118.js.LICENSE.txt +0 -39
  147. package/__mf/js/async/4121.e7df36d6.js +0 -2
  148. package/__mf/js/async/5002.3eb39a8c.js +0 -1
  149. package/__mf/js/async/5021.c663603d.js +0 -1
  150. package/__mf/js/async/5071.839a8f1a.js +0 -1
  151. package/__mf/js/async/5481.6496fac9.js +0 -2
  152. package/__mf/js/async/5587.a8a428db.js +0 -1
  153. package/__mf/js/async/6274.8edae86d.js +0 -2
  154. package/__mf/js/async/629.8cff215d.js +0 -1
  155. package/__mf/js/async/6811.9d4b123a.js +0 -38
  156. package/__mf/js/async/7177.e0e5ba2f.js +0 -1
  157. package/__mf/js/async/7192.692181c8.js +0 -1
  158. package/__mf/js/async/7413.c9310b8a.js +0 -1
  159. package/__mf/js/async/7968.3a9a982e.js +0 -1
  160. package/__mf/js/async/7978.116e4d81.js +0 -1
  161. package/__mf/js/async/7984.a8edc213.js +0 -22
  162. package/__mf/js/async/8356.152d5686.js +0 -1
  163. package/__mf/js/async/8470.b9762117.js +0 -2
  164. package/__mf/js/async/873.264fedc9.js +0 -1
  165. package/__mf/js/async/9051.c4deebd7.js +0 -1
  166. package/__mf/js/async/9235.c67cdb1d.js +0 -1
  167. package/__mf/js/async/941.cc458a98.js +0 -2
  168. package/__mf/js/async/9588.d23e2ed3.js +0 -1
  169. package/__mf/js/async/9701.9c4cea02.js +0 -1
  170. package/__mf/js/async/__federation_expose_Table.5d0cfb46.js +0 -1
  171. package/__mf/js/async/lib-router.3493bbf9.js +0 -2
  172. package/lib/cjs/Table.js +0 -62
  173. package/lib/cjs/TableExportAction.js +0 -180
  174. package/lib/cjs/bootstrap.js +0 -26
  175. package/lib/cjs/components/CellsEditor/CellsEditor.js +0 -30
  176. package/lib/cjs/components/CellsEditor/index.js +0 -30
  177. package/lib/cjs/components/ColumnsEditor/ColumnEditor.js +0 -289
  178. package/lib/cjs/components/ColumnsEditor/ColumnEditorContainer.js +0 -152
  179. package/lib/cjs/components/ColumnsEditor/ColumnsEditor.js +0 -108
  180. package/lib/cjs/components/ColumnsEditor/DataLinkEditorDialog.js +0 -139
  181. package/lib/cjs/components/ColumnsEditor/EmbeddedPanelOptionsEditor.js +0 -124
  182. package/lib/cjs/components/ColumnsEditor/index.js +0 -32
  183. package/lib/cjs/components/ConditionalPanel.js +0 -367
  184. package/lib/cjs/components/EmbeddedPanel.js +0 -52
  185. package/lib/cjs/components/TableCellsEditor.js +0 -36
  186. package/lib/cjs/components/TableColumnsEditor.js +0 -36
  187. package/lib/cjs/components/TableItemSelectionActionsEditor.js +0 -44
  188. package/lib/cjs/components/TablePanel.js +0 -845
  189. package/lib/cjs/components/TableSettingsEditor.js +0 -144
  190. package/lib/cjs/components/TableTransformsEditor.js +0 -36
  191. package/lib/cjs/components/index.js +0 -38
  192. package/lib/cjs/env.d.js +0 -14
  193. package/lib/cjs/getPluginModule.js +0 -39
  194. package/lib/cjs/index-federation.js +0 -55
  195. package/lib/cjs/index.js +0 -39
  196. package/lib/cjs/models/index.js +0 -31
  197. package/lib/cjs/models/model.js +0 -16
  198. package/lib/cjs/models/table-model.js +0 -278
  199. package/lib/cjs/setup-tests.js +0 -19
  200. package/lib/cjs/table-data-utils.js +0 -84
  201. package/lib/cjs/test/mock-query-results.js +0 -524
  202. /package/__mf/css/async/{4014.85c2cbf6.css → 11.85c2cbf6.css} +0 -0
  203. /package/__mf/js/async/{4121.e7df36d6.js.LICENSE.txt → 121.b3a4c6cf.js.LICENSE.txt} +0 -0
  204. /package/__mf/js/async/{6274.8edae86d.js.LICENSE.txt → 274.f7dabfa6.js.LICENSE.txt} +0 -0
  205. /package/__mf/js/async/{392.b6035b41.js.LICENSE.txt → 392.e853a818.js.LICENSE.txt} +0 -0
  206. /package/__mf/js/async/{8470.b9762117.js.LICENSE.txt → 470.21434f20.js.LICENSE.txt} +0 -0
  207. /package/__mf/js/async/{7984.a8edc213.js.LICENSE.txt → 522.d6a7c203.js.LICENSE.txt} +0 -0
  208. /package/__mf/js/async/{868.507e984c.js.LICENSE.txt → 741.7feaa0ba.js.LICENSE.txt} +0 -0
  209. /package/__mf/js/async/{5481.6496fac9.js.LICENSE.txt → 862.4c658639.js.LICENSE.txt} +0 -0
  210. /package/__mf/js/async/{941.cc458a98.js.LICENSE.txt → 941.08c16cb2.js.LICENSE.txt} +0 -0
  211. /package/__mf/js/async/{lib-router.3493bbf9.js.LICENSE.txt → lib-router.020a2a16.js.LICENSE.txt} +0 -0
@@ -1,180 +0,0 @@
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
- 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 () {
25
- return TableExportAction;
26
- },
27
- get buildTableData () {
28
- return buildTableData;
29
- }
30
- });
31
- const _jsxruntime = require("react/jsx-runtime");
32
- const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
33
- const _pluginsystem = require("@perses-dev/plugin-system");
34
- const _components = require("@perses-dev/components");
35
- const _material = require("@mui/material");
36
- const _Download = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Download"));
37
- const _tabledatautils = require("./table-data-utils");
38
- function _interop_require_default(obj) {
39
- return obj && obj.__esModule ? obj : {
40
- default: obj
41
- };
42
- }
43
- function _getRequireWildcardCache(nodeInterop) {
44
- if (typeof WeakMap !== "function") return null;
45
- var cacheBabelInterop = new WeakMap();
46
- var cacheNodeInterop = new WeakMap();
47
- return (_getRequireWildcardCache = function(nodeInterop) {
48
- return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
49
- })(nodeInterop);
50
- }
51
- function _interop_require_wildcard(obj, nodeInterop) {
52
- if (!nodeInterop && obj && obj.__esModule) {
53
- return obj;
54
- }
55
- if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
56
- return {
57
- default: obj
58
- };
59
- }
60
- var cache = _getRequireWildcardCache(nodeInterop);
61
- if (cache && cache.has(obj)) {
62
- return cache.get(obj);
63
- }
64
- var newObj = {
65
- __proto__: null
66
- };
67
- var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
68
- for(var key in obj){
69
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
70
- var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
71
- if (desc && (desc.get || desc.set)) {
72
- Object.defineProperty(newObj, key, desc);
73
- } else {
74
- newObj[key] = obj[key];
75
- }
76
- }
77
- }
78
- newObj.default = obj;
79
- if (cache) {
80
- cache.set(obj, newObj);
81
- }
82
- return newObj;
83
- }
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
127
- ]);
128
- const canExport = tableData.data.length > 0 && tableData.columns.length > 0;
129
- const handleExport = (0, _react.useCallback)(()=>{
130
- if (!canExport) return;
131
- try {
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'
144
- });
145
- const baseFilename = (0, _pluginsystem.sanitizeFilename)(title);
146
- const filename = `${baseFilename}_data.csv`;
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
- }
158
- } catch (error) {
159
- console.error('Table CSV export failed:', error);
160
- }
161
- }, [
162
- canExport,
163
- tableData,
164
- definition
165
- ]);
166
- if (!canExport) {
167
- return null;
168
- }
169
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.InfoTooltip, {
170
- description: "Export as CSV",
171
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
172
- size: "small",
173
- onClick: handleExport,
174
- "aria-label": "Export table data as CSV",
175
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Download.default, {
176
- fontSize: "inherit"
177
- })
178
- })
179
- });
180
- };
@@ -1,26 +0,0 @@
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
- const _jsxruntime = require("react/jsx-runtime");
18
- const _react = /*#__PURE__*/ _interop_require_default(require("react"));
19
- const _client = /*#__PURE__*/ _interop_require_default(require("react-dom/client"));
20
- function _interop_require_default(obj) {
21
- return obj && obj.__esModule ? obj : {
22
- default: obj
23
- };
24
- }
25
- const root = _client.default.createRoot(document.getElementById('root'));
26
- root.render(/*#__PURE__*/ (0, _jsxruntime.jsx)(_react.default.StrictMode, {}));
@@ -1,30 +0,0 @@
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, "CellsEditor", {
18
- enumerable: true,
19
- get: function() {
20
- return CellsEditor;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _ConditionalPanel = require("../ConditionalPanel");
25
- function CellsEditor({ cellSettings, onChange }) {
26
- return /*#__PURE__*/ (0, _jsxruntime.jsx)(_ConditionalPanel.ConditionalPanel, {
27
- cellSettings: cellSettings,
28
- onChange: (updatedCellSettings)=>onChange(updatedCellSettings || [])
29
- });
30
- }
@@ -1,30 +0,0 @@
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
- _export_star(require("./CellsEditor"), exports);
18
- function _export_star(from, to) {
19
- Object.keys(from).forEach(function(k) {
20
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
21
- Object.defineProperty(to, k, {
22
- enumerable: true,
23
- get: function() {
24
- return from[k];
25
- }
26
- });
27
- }
28
- });
29
- return from;
30
- }
@@ -1,289 +0,0 @@
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, "ColumnEditor", {
18
- enumerable: true,
19
- get: function() {
20
- return ColumnEditor;
21
- }
22
- });
23
- const _jsxruntime = require("react/jsx-runtime");
24
- const _material = require("@mui/material");
25
- const _react = require("react");
26
- const _components = require("@perses-dev/components");
27
- const _pluginsystem = require("@perses-dev/plugin-system");
28
- const _ConditionalPanel = require("../ConditionalPanel");
29
- const _DataLinkEditorDialog = require("./DataLinkEditorDialog");
30
- const _EmbeddedPanelOptionsEditor = require("./EmbeddedPanelOptionsEditor");
31
- const DEFAULT_FORMAT = {
32
- unit: 'decimal',
33
- shortValues: true
34
- };
35
- function ColumnEditor({ column, onChange, ...others }) {
36
- const [width, setWidth] = (0, _react.useState)(column.width === undefined || column.width === 'auto' ? 100 : column.width);
37
- return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
38
- ...others,
39
- children: [
40
- /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGrid, {
41
- children: [
42
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorColumn, {
43
- children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGroup, {
44
- title: "Column",
45
- children: [
46
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
47
- label: "Name*",
48
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
49
- value: column.name,
50
- onChange: (e)=>onChange({
51
- ...column,
52
- name: e.target.value
53
- }),
54
- required: true
55
- })
56
- }),
57
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
58
- label: "Header",
59
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
60
- value: column.header ?? '',
61
- onChange: (e)=>onChange({
62
- ...column,
63
- header: e.target.value ? e.target.value : undefined
64
- })
65
- })
66
- }),
67
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
68
- label: "Header Tooltip",
69
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
70
- value: column.headerDescription ?? '',
71
- onChange: (e)=>onChange({
72
- ...column,
73
- headerDescription: e.target.value ? e.target.value : undefined
74
- })
75
- })
76
- }),
77
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
78
- label: "Cell Tooltip",
79
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
80
- value: column.cellDescription ?? '',
81
- onChange: (e)=>onChange({
82
- ...column,
83
- cellDescription: e.target.value ? e.target.value : undefined
84
- })
85
- })
86
- }),
87
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
88
- label: "Enable sorting",
89
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
90
- checked: column.enableSorting ?? false,
91
- onChange: (e)=>onChange({
92
- ...column,
93
- enableSorting: e.target.checked
94
- })
95
- })
96
- }),
97
- column.enableSorting && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
98
- label: "Default Sort",
99
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SortSelectorButtons, {
100
- size: "medium",
101
- value: column.sort,
102
- sx: {
103
- margin: 0.5
104
- },
105
- onChange: (sort)=>onChange({
106
- ...column,
107
- sort: sort
108
- })
109
- })
110
- })
111
- ]
112
- })
113
- }),
114
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorColumn, {
115
- children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGroup, {
116
- title: "Visual",
117
- children: [
118
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
119
- label: "Show column",
120
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
121
- checked: !(column.hide ?? false),
122
- onChange: (e)=>onChange({
123
- ...column,
124
- hide: !e.target.checked
125
- })
126
- })
127
- }),
128
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
129
- label: "Cell display",
130
- control: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
131
- spacing: 1,
132
- children: [
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"
144
- }),
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
- ]
157
- }),
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."
165
- })
166
- ]
167
- })
168
- }),
169
- column.plugin ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
170
- label: "Visualization type",
171
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginKindSelect, {
172
- pluginTypes: [
173
- 'Panel'
174
- ],
175
- size: "small",
176
- value: {
177
- type: 'Panel',
178
- kind: column.plugin.kind
179
- },
180
- onChange: (event)=>onChange({
181
- ...column,
182
- plugin: {
183
- kind: event.kind,
184
- spec: {}
185
- }
186
- })
187
- })
188
- }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.FormatControls, {
189
- value: column.format ?? DEFAULT_FORMAT,
190
- onChange: (newFormat)=>onChange({
191
- ...column,
192
- format: newFormat
193
- })
194
- }),
195
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
196
- label: "Alignment",
197
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.AlignSelector, {
198
- size: "small",
199
- value: column.align ?? 'left',
200
- onChange: (align)=>onChange({
201
- ...column,
202
- align: align
203
- })
204
- })
205
- }),
206
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
207
- label: "Custom width",
208
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
209
- checked: column.width !== undefined && column.width !== 'auto',
210
- onChange: (e)=>onChange({
211
- ...column,
212
- width: e.target.checked ? width : 'auto'
213
- })
214
- })
215
- }),
216
- column.width !== undefined && column.width !== 'auto' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
217
- label: "Width",
218
- control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
219
- type: "number",
220
- value: width,
221
- slotProps: {
222
- htmlInput: {
223
- min: 1
224
- }
225
- },
226
- onChange: (e)=>{
227
- setWidth(+e.target.value);
228
- onChange({
229
- ...column,
230
- width: +e.target.value
231
- });
232
- }
233
- })
234
- })
235
- ]
236
- })
237
- }),
238
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorColumn, {
239
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorGroup, {
240
- title: "Link",
241
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DataLinkEditorDialog.DataLinkEditor, {
242
- column: column,
243
- onChange: onChange
244
- })
245
- })
246
- })
247
- ]
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
- }),
271
- /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
272
- sx: {
273
- px: 8,
274
- mt: column.plugin?.kind === 'GaugeChart' ? 3 : 0
275
- },
276
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorGroup, {
277
- title: "Conditional Cell Format",
278
- children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ConditionalPanel.ConditionalPanel, {
279
- cellSettings: column.cellSettings,
280
- onChange: (cellSettings)=>onChange({
281
- ...column,
282
- cellSettings
283
- })
284
- })
285
- })
286
- })
287
- ]
288
- });
289
- }