@perses-dev/table-plugin 0.6.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 (198) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +41 -0
  3. package/__mf/css/async/2341.cbbd94a8.css +1 -0
  4. package/__mf/css/async/5263.cbbd94a8.css +1 -0
  5. package/__mf/css/async/6759.cbbd94a8.css +1 -0
  6. package/__mf/css/async/8433.cbbd94a8.css +1 -0
  7. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  8. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  9. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  10. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  11. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  12. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  13. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  14. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  17. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  18. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  19. package/__mf/js/6487.f255ba88.js +5 -0
  20. package/__mf/js/Table.510470af.js +5 -0
  21. package/__mf/js/async/1620.ed8d9b3d.js +2 -0
  22. package/__mf/js/async/1620.ed8d9b3d.js.LICENSE.txt +9 -0
  23. package/__mf/js/async/1640.ff18956a.js +1 -0
  24. package/__mf/js/async/1722.586085f2.js +1 -0
  25. package/__mf/js/async/1964.979a7101.js +2 -0
  26. package/__mf/js/async/1964.979a7101.js.LICENSE.txt +9 -0
  27. package/__mf/js/async/1996.e0e5fb2a.js +2 -0
  28. package/__mf/js/async/1996.e0e5fb2a.js.LICENSE.txt +24 -0
  29. package/__mf/js/async/232.ab228ab3.js +1 -0
  30. package/__mf/js/async/2399.8ceb88c6.js +23 -0
  31. package/__mf/js/async/2641.78a9e888.js +1 -0
  32. package/__mf/js/async/2651.7c8030f0.js +1 -0
  33. package/__mf/js/async/3001.51d0062c.js +1 -0
  34. package/__mf/js/async/3224.fbb884ab.js +1 -0
  35. package/__mf/js/async/3598.66df4cef.js +1 -0
  36. package/__mf/js/async/3660.4a5855e1.js +23 -0
  37. package/__mf/js/async/3893.f1c71cae.js +1 -0
  38. package/__mf/js/async/3960.c992ac30.js +2 -0
  39. package/__mf/js/async/3960.c992ac30.js.LICENSE.txt +8 -0
  40. package/__mf/js/async/4062.0dd7dc24.js +1 -0
  41. package/__mf/js/async/4075.4fb81a28.js +1 -0
  42. package/__mf/js/async/4238.e22a8e1b.js +1 -0
  43. package/__mf/js/async/4446.9a215492.js +1 -0
  44. package/__mf/js/async/468.cca77551.js +110 -0
  45. package/__mf/js/async/468.cca77551.js.LICENSE.txt +27 -0
  46. package/__mf/js/async/4741.ceabfbaa.js +38 -0
  47. package/__mf/js/async/52.77f8a241.js +2 -0
  48. package/__mf/js/async/52.77f8a241.js.LICENSE.txt +37 -0
  49. package/__mf/js/async/5214.19ee9ad8.js +1 -0
  50. package/__mf/js/async/5377.05ab91aa.js +1 -0
  51. package/__mf/js/async/5409.3c667e6d.js +1 -0
  52. package/__mf/js/async/5662.d6ae2721.js +1 -0
  53. package/__mf/js/async/5767.6be60775.js +1 -0
  54. package/__mf/js/async/5912.b68e4631.js +1 -0
  55. package/__mf/js/async/5981.95116879.js +2 -0
  56. package/__mf/js/async/5981.95116879.js.LICENSE.txt +8 -0
  57. package/__mf/js/async/5998.ac755fc8.js +73 -0
  58. package/__mf/js/async/5998.ac755fc8.js.LICENSE.txt +19 -0
  59. package/__mf/js/async/6292.20be7eae.js +1 -0
  60. package/__mf/js/async/6333.35401612.js +2 -0
  61. package/__mf/js/async/6333.35401612.js.LICENSE.txt +9 -0
  62. package/__mf/js/async/654.fd64ef4b.js +1 -0
  63. package/__mf/js/async/6757.5675a614.js +7 -0
  64. package/__mf/js/async/6757.5675a614.js.LICENSE.txt +21 -0
  65. package/__mf/js/async/6770.84690346.js +1 -0
  66. package/__mf/js/async/6884.5426473f.js +1 -0
  67. package/__mf/js/async/694.4b146780.js +1 -0
  68. package/__mf/js/async/738.e2fbbd72.js +1 -0
  69. package/__mf/js/async/7606.4ba8e3ec.js +1 -0
  70. package/__mf/js/async/7740.dcade8b6.js +1 -0
  71. package/__mf/js/async/8444.d0d247d8.js +1 -0
  72. package/__mf/js/async/8488.d5eddfc6.js +1 -0
  73. package/__mf/js/async/8807.f0e4209b.js +1 -0
  74. package/__mf/js/async/894.1c4bbdb5.js +1 -0
  75. package/__mf/js/async/9010.8332598b.js +1 -0
  76. package/__mf/js/async/9173.00408de3.js +2 -0
  77. package/__mf/js/async/9173.00408de3.js.LICENSE.txt +19 -0
  78. package/__mf/js/async/9509.e6075bf0.js +1 -0
  79. package/__mf/js/async/__federation_expose_Table.0b081d4a.js +1 -0
  80. package/__mf/js/async/lib-router.d60ae988.js +2 -0
  81. package/__mf/js/async/lib-router.d60ae988.js.LICENSE.txt +32 -0
  82. package/__mf/js/main.fa5edfce.js +1 -0
  83. package/lib/CellsEditor/CellEditor.d.ts +10 -0
  84. package/lib/CellsEditor/CellEditor.d.ts.map +1 -0
  85. package/lib/CellsEditor/CellEditor.js +372 -0
  86. package/lib/CellsEditor/CellEditor.js.map +1 -0
  87. package/lib/CellsEditor/CellsEditor.d.ts +8 -0
  88. package/lib/CellsEditor/CellsEditor.d.ts.map +1 -0
  89. package/lib/CellsEditor/CellsEditor.js +123 -0
  90. package/lib/CellsEditor/CellsEditor.js.map +1 -0
  91. package/lib/CellsEditor/index.d.ts +3 -0
  92. package/lib/CellsEditor/index.d.ts.map +1 -0
  93. package/lib/CellsEditor/index.js +16 -0
  94. package/lib/CellsEditor/index.js.map +1 -0
  95. package/lib/ColumnsEditor/ColumnEditor.d.ts +11 -0
  96. package/lib/ColumnsEditor/ColumnEditor.d.ts.map +1 -0
  97. package/lib/ColumnsEditor/ColumnEditor.js +213 -0
  98. package/lib/ColumnsEditor/ColumnEditor.js.map +1 -0
  99. package/lib/ColumnsEditor/ColumnEditorContainer.d.ts +11 -0
  100. package/lib/ColumnsEditor/ColumnEditorContainer.d.ts.map +1 -0
  101. package/lib/ColumnsEditor/ColumnEditorContainer.js +139 -0
  102. package/lib/ColumnsEditor/ColumnEditorContainer.js.map +1 -0
  103. package/lib/ColumnsEditor/ColumnsEditor.d.ts +8 -0
  104. package/lib/ColumnsEditor/ColumnsEditor.d.ts.map +1 -0
  105. package/lib/ColumnsEditor/ColumnsEditor.js +95 -0
  106. package/lib/ColumnsEditor/ColumnsEditor.js.map +1 -0
  107. package/lib/ColumnsEditor/index.d.ts +4 -0
  108. package/lib/ColumnsEditor/index.d.ts.map +1 -0
  109. package/lib/ColumnsEditor/index.js +17 -0
  110. package/lib/ColumnsEditor/index.js.map +1 -0
  111. package/lib/EmbeddedPanel.d.ts +10 -0
  112. package/lib/EmbeddedPanel.d.ts.map +1 -0
  113. package/lib/EmbeddedPanel.js +39 -0
  114. package/lib/EmbeddedPanel.js.map +1 -0
  115. package/lib/Table.d.ts +8 -0
  116. package/lib/Table.d.ts.map +1 -0
  117. package/lib/Table.js +48 -0
  118. package/lib/Table.js.map +1 -0
  119. package/lib/TableCellsEditor.d.ts +6 -0
  120. package/lib/TableCellsEditor.d.ts.map +1 -0
  121. package/lib/TableCellsEditor.js +28 -0
  122. package/lib/TableCellsEditor.js.map +1 -0
  123. package/lib/TableColumnsEditor.d.ts +6 -0
  124. package/lib/TableColumnsEditor.d.ts.map +1 -0
  125. package/lib/TableColumnsEditor.js +28 -0
  126. package/lib/TableColumnsEditor.js.map +1 -0
  127. package/lib/TablePanel.d.ts +10 -0
  128. package/lib/TablePanel.d.ts.map +1 -0
  129. package/lib/TablePanel.js +325 -0
  130. package/lib/TablePanel.js.map +1 -0
  131. package/lib/TableSettingsEditor.d.ts +4 -0
  132. package/lib/TableSettingsEditor.d.ts.map +1 -0
  133. package/lib/TableSettingsEditor.js +108 -0
  134. package/lib/TableSettingsEditor.js.map +1 -0
  135. package/lib/TableTransformsEditor.d.ts +4 -0
  136. package/lib/TableTransformsEditor.d.ts.map +1 -0
  137. package/lib/TableTransformsEditor.js +28 -0
  138. package/lib/TableTransformsEditor.js.map +1 -0
  139. package/lib/bootstrap.d.ts +2 -0
  140. package/lib/bootstrap.d.ts.map +1 -0
  141. package/lib/bootstrap.js +19 -0
  142. package/lib/bootstrap.js.map +1 -0
  143. package/lib/cjs/CellsEditor/CellEditor.js +385 -0
  144. package/lib/cjs/CellsEditor/CellsEditor.js +136 -0
  145. package/lib/cjs/CellsEditor/index.js +31 -0
  146. package/lib/cjs/ColumnsEditor/ColumnEditor.js +221 -0
  147. package/lib/cjs/ColumnsEditor/ColumnEditorContainer.js +152 -0
  148. package/lib/cjs/ColumnsEditor/ColumnsEditor.js +108 -0
  149. package/lib/cjs/ColumnsEditor/index.js +32 -0
  150. package/lib/cjs/EmbeddedPanel.js +52 -0
  151. package/lib/cjs/Table.js +54 -0
  152. package/lib/cjs/TableCellsEditor.js +36 -0
  153. package/lib/cjs/TableColumnsEditor.js +36 -0
  154. package/lib/cjs/TablePanel.js +341 -0
  155. package/lib/cjs/TableSettingsEditor.js +116 -0
  156. package/lib/cjs/TableTransformsEditor.js +36 -0
  157. package/lib/cjs/bootstrap.js +26 -0
  158. package/lib/cjs/env.d.js +14 -0
  159. package/lib/cjs/getPluginModule.js +27 -0
  160. package/lib/cjs/index-federation.js +55 -0
  161. package/lib/cjs/index.js +34 -0
  162. package/lib/cjs/model.js +4 -0
  163. package/lib/cjs/setup-tests.js +19 -0
  164. package/lib/cjs/table-model.js +27 -0
  165. package/lib/cjs/test/mock-query-results.js +417 -0
  166. package/lib/env.d.js +15 -0
  167. package/lib/env.d.js.map +1 -0
  168. package/lib/getPluginModule.d.ts +6 -0
  169. package/lib/getPluginModule.d.ts.map +1 -0
  170. package/lib/getPluginModule.js +16 -0
  171. package/lib/getPluginModule.js.map +1 -0
  172. package/lib/index-federation.d.ts +1 -0
  173. package/lib/index-federation.d.ts.map +1 -0
  174. package/lib/index-federation.js +15 -0
  175. package/lib/index-federation.js.map +1 -0
  176. package/lib/index.d.ts +12 -0
  177. package/lib/index.d.ts.map +1 -0
  178. package/lib/index.js +13 -0
  179. package/lib/index.js.map +1 -0
  180. package/lib/model.d.ts +6 -0
  181. package/lib/model.d.ts.map +1 -0
  182. package/lib/model.js +3 -0
  183. package/lib/model.js.map +1 -0
  184. package/lib/setup-tests.d.ts +2 -0
  185. package/lib/setup-tests.d.ts.map +1 -0
  186. package/lib/setup-tests.js +17 -0
  187. package/lib/setup-tests.js.map +1 -0
  188. package/lib/table-model.d.ts +92 -0
  189. package/lib/table-model.d.ts.map +1 -0
  190. package/lib/table-model.js +21 -0
  191. package/lib/table-model.js.map +1 -0
  192. package/lib/test/mock-query-results.d.ts +136 -0
  193. package/lib/test/mock-query-results.d.ts.map +1 -0
  194. package/lib/test/mock-query-results.js +389 -0
  195. package/lib/test/mock-query-results.js.map +1 -0
  196. package/mf-manifest.json +491 -0
  197. package/mf-stats.json +554 -0
  198. package/package.json +60 -0
@@ -0,0 +1,136 @@
1
+ // Copyright 2024 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 _material = require("@mui/material");
25
+ const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
26
+ const _CellEditor = require("./CellEditor");
27
+ function _interop_require_default(obj) {
28
+ return obj && obj.__esModule ? obj : {
29
+ default: obj
30
+ };
31
+ }
32
+ function CellsEditor({ cellSettings, onChange }) {
33
+ function handleCellChange(index, cell) {
34
+ const updatedCells = [
35
+ ...cellSettings
36
+ ];
37
+ updatedCells[index] = cell;
38
+ onChange(updatedCells);
39
+ }
40
+ function handleAddCellEditor() {
41
+ const updatedCells = [
42
+ ...cellSettings
43
+ ];
44
+ updatedCells.push({
45
+ condition: {
46
+ kind: 'Value',
47
+ spec: {
48
+ value: ''
49
+ }
50
+ }
51
+ });
52
+ onChange(updatedCells);
53
+ }
54
+ function handleCellDelete(index) {
55
+ const updatedCells = [
56
+ ...cellSettings
57
+ ];
58
+ updatedCells.splice(index, 1);
59
+ onChange(updatedCells);
60
+ }
61
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
62
+ spacing: 1,
63
+ children: [
64
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Grid2, {
65
+ container: true,
66
+ spacing: 2,
67
+ children: [
68
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
69
+ size: {
70
+ xs: 5
71
+ },
72
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
73
+ variant: "subtitle1",
74
+ children: "Condition"
75
+ })
76
+ }),
77
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
78
+ size: {
79
+ xs: 4
80
+ },
81
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
82
+ variant: "subtitle1",
83
+ children: "Display Text"
84
+ })
85
+ }),
86
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
87
+ size: {
88
+ xs: 1
89
+ },
90
+ textAlign: "center",
91
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
92
+ variant: "subtitle1",
93
+ children: "Color"
94
+ })
95
+ }),
96
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
97
+ size: {
98
+ xs: 1
99
+ },
100
+ textAlign: "center",
101
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
102
+ variant: "subtitle1",
103
+ children: "Background"
104
+ })
105
+ }),
106
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Grid2, {
107
+ size: {
108
+ xs: 1
109
+ }
110
+ })
111
+ ]
112
+ }),
113
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
114
+ gap: 1.5,
115
+ divider: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {
116
+ flexItem: true,
117
+ orientation: "horizontal"
118
+ }),
119
+ children: cellSettings.map((cell, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_CellEditor.CellEditor, {
120
+ cell: cell,
121
+ onChange: (updatedCell)=>handleCellChange(i, updatedCell),
122
+ onDelete: ()=>handleCellDelete(i)
123
+ }, i))
124
+ }),
125
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
126
+ variant: "contained",
127
+ startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {}),
128
+ sx: {
129
+ marginTop: 1
130
+ },
131
+ onClick: handleAddCellEditor,
132
+ children: "Add Cell Settings"
133
+ })
134
+ ]
135
+ });
136
+ }
@@ -0,0 +1,31 @@
1
+ // Copyright 2024 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("./CellEditor"), exports);
18
+ _export_star(require("./CellsEditor"), exports);
19
+ function _export_star(from, to) {
20
+ Object.keys(from).forEach(function(k) {
21
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
22
+ Object.defineProperty(to, k, {
23
+ enumerable: true,
24
+ get: function() {
25
+ return from[k];
26
+ }
27
+ });
28
+ }
29
+ });
30
+ return from;
31
+ }
@@ -0,0 +1,221 @@
1
+ // Copyright 2024 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 DEFAULT_FORMAT = {
29
+ unit: 'decimal',
30
+ shortValues: true
31
+ };
32
+ function ColumnEditor({ column, onChange, ...others }) {
33
+ const [width, setWidth] = (0, _react.useState)(column.width === undefined || column.width === 'auto' ? 100 : column.width);
34
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGrid, {
35
+ ...others,
36
+ children: [
37
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorColumn, {
38
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGroup, {
39
+ title: "Column",
40
+ children: [
41
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
42
+ label: "Name*",
43
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
44
+ value: column.name,
45
+ onChange: (e)=>onChange({
46
+ ...column,
47
+ name: e.target.value
48
+ }),
49
+ required: true
50
+ })
51
+ }),
52
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
53
+ label: "Header",
54
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
55
+ value: column.header ?? '',
56
+ onChange: (e)=>onChange({
57
+ ...column,
58
+ header: e.target.value ? e.target.value : undefined
59
+ })
60
+ })
61
+ }),
62
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
63
+ label: "Header Tooltip",
64
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
65
+ value: column.headerDescription ?? '',
66
+ onChange: (e)=>onChange({
67
+ ...column,
68
+ headerDescription: e.target.value ? e.target.value : undefined
69
+ })
70
+ })
71
+ }),
72
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
73
+ label: "Cell Tooltip",
74
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
75
+ value: column.cellDescription ?? '',
76
+ onChange: (e)=>onChange({
77
+ ...column,
78
+ cellDescription: e.target.value ? e.target.value : undefined
79
+ })
80
+ })
81
+ }),
82
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
83
+ label: "Enable sorting",
84
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
85
+ checked: column.enableSorting ?? false,
86
+ onChange: (e)=>onChange({
87
+ ...column,
88
+ enableSorting: e.target.checked
89
+ })
90
+ })
91
+ }),
92
+ column.enableSorting && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
93
+ label: "Default Sort",
94
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.SortSelectorButtons, {
95
+ size: "medium",
96
+ value: column.sort,
97
+ sx: {
98
+ margin: 0.5
99
+ },
100
+ onChange: (sort)=>onChange({
101
+ ...column,
102
+ sort: sort
103
+ })
104
+ })
105
+ })
106
+ ]
107
+ })
108
+ }),
109
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorColumn, {
110
+ children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGroup, {
111
+ title: "Visual",
112
+ children: [
113
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
114
+ label: "Show column",
115
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
116
+ checked: !(column.hide ?? false),
117
+ onChange: (e)=>onChange({
118
+ ...column,
119
+ hide: !e.target.checked
120
+ })
121
+ })
122
+ }),
123
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
124
+ label: "Display",
125
+ control: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.ButtonGroup, {
126
+ "aria-label": "Display",
127
+ size: "small",
128
+ children: [
129
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
130
+ variant: !column.plugin ? 'contained' : 'outlined',
131
+ onClick: ()=>onChange({
132
+ ...column,
133
+ plugin: undefined
134
+ }),
135
+ children: "Text"
136
+ }),
137
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
138
+ variant: column.plugin ? 'contained' : 'outlined',
139
+ onClick: ()=>onChange({
140
+ ...column,
141
+ plugin: {
142
+ kind: 'StatChart',
143
+ spec: {}
144
+ }
145
+ }),
146
+ children: "Embedded Panel"
147
+ })
148
+ ]
149
+ })
150
+ }),
151
+ column.plugin ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
152
+ label: "Panel Type",
153
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_pluginsystem.PluginKindSelect, {
154
+ pluginTypes: [
155
+ 'Panel'
156
+ ],
157
+ value: {
158
+ type: 'Panel',
159
+ kind: column.plugin.kind
160
+ },
161
+ onChange: (event)=>onChange({
162
+ ...column,
163
+ plugin: {
164
+ kind: event.kind,
165
+ spec: {}
166
+ }
167
+ })
168
+ })
169
+ }) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.FormatControls, {
170
+ value: column.format ?? DEFAULT_FORMAT,
171
+ onChange: (newFormat)=>onChange({
172
+ ...column,
173
+ format: newFormat
174
+ })
175
+ }),
176
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
177
+ label: "Alignment",
178
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.AlignSelector, {
179
+ size: "small",
180
+ value: column.align ?? 'left',
181
+ onChange: (align)=>onChange({
182
+ ...column,
183
+ align: align
184
+ })
185
+ })
186
+ }),
187
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
188
+ label: "Custom width",
189
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
190
+ checked: column.width !== undefined && column.width !== 'auto',
191
+ onChange: (e)=>onChange({
192
+ ...column,
193
+ width: e.target.checked ? width : 'auto'
194
+ })
195
+ })
196
+ }),
197
+ column.width !== undefined && column.width !== 'auto' && /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
198
+ label: "Width",
199
+ control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
200
+ type: "number",
201
+ value: width,
202
+ slotProps: {
203
+ htmlInput: {
204
+ min: 1
205
+ }
206
+ },
207
+ onChange: (e)=>{
208
+ setWidth(+e.target.value);
209
+ onChange({
210
+ ...column,
211
+ width: +e.target.value
212
+ });
213
+ }
214
+ })
215
+ })
216
+ ]
217
+ })
218
+ })
219
+ ]
220
+ });
221
+ }
@@ -0,0 +1,152 @@
1
+ // Copyright 2024 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, "ColumnEditorContainer", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return ColumnEditorContainer;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _ChevronRight = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronRight"));
26
+ const _ChevronDown = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/ChevronDown"));
27
+ const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
28
+ const _EyeOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/EyeOutline"));
29
+ const _EyeOffOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/EyeOffOutline"));
30
+ const _components = require("@perses-dev/components");
31
+ const _ColumnEditor = require("./ColumnEditor");
32
+ function _interop_require_default(obj) {
33
+ return obj && obj.__esModule ? obj : {
34
+ default: obj
35
+ };
36
+ }
37
+ function ColumnEditorContainer({ column, isCollapsed, onChange, onCollapse, onDelete, onMoveUp, onMoveDown }) {
38
+ function handleHideColumn() {
39
+ onChange({
40
+ ...column,
41
+ hide: !column.hide
42
+ });
43
+ }
44
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.DragAndDropElement, {
45
+ data: column,
46
+ children: [
47
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
48
+ direction: "row",
49
+ alignItems: "center",
50
+ borderBottom: 1,
51
+ borderColor: (theme)=>theme.palette.divider,
52
+ justifyContent: "space-between",
53
+ gap: 4,
54
+ children: [
55
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
56
+ direction: "row",
57
+ gap: 1,
58
+ children: [
59
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
60
+ "data-testid": `column-toggle#${column.name}`,
61
+ size: "small",
62
+ onClick: ()=>onCollapse(!isCollapsed),
63
+ children: isCollapsed ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronRight.default, {}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_ChevronDown.default, {})
64
+ }),
65
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Typography, {
66
+ variant: "overline",
67
+ component: "h4",
68
+ sx: {
69
+ textTransform: 'none'
70
+ },
71
+ children: [
72
+ "COLUMN:",
73
+ ' ',
74
+ column.header ? /*#__PURE__*/ (0, _jsxruntime.jsxs)("span", {
75
+ children: [
76
+ /*#__PURE__*/ (0, _jsxruntime.jsx)("strong", {
77
+ children: column.header
78
+ }),
79
+ " (",
80
+ column.name,
81
+ ")"
82
+ ]
83
+ }) : /*#__PURE__*/ (0, _jsxruntime.jsx)("strong", {
84
+ children: column.name
85
+ })
86
+ ]
87
+ })
88
+ ]
89
+ }),
90
+ /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
91
+ direction: "row",
92
+ gap: 1,
93
+ children: [
94
+ isCollapsed && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
95
+ children: [
96
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tooltip, {
97
+ title: column.hide ? 'Show column' : 'Hide column',
98
+ placement: "top",
99
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
100
+ size: "small",
101
+ sx: {
102
+ marginLeft: 'auto'
103
+ },
104
+ onClick: handleHideColumn,
105
+ children: column.hide ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_EyeOffOutline.default, {}) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_EyeOutline.default, {})
106
+ }, "hide-column")
107
+ }),
108
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Divider, {
109
+ flexItem: true,
110
+ orientation: "vertical",
111
+ variant: "middle"
112
+ })
113
+ ]
114
+ }),
115
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tooltip, {
116
+ title: "Remove column settings",
117
+ placement: "top",
118
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
119
+ size: "small",
120
+ sx: {
121
+ marginLeft: 'auto'
122
+ },
123
+ onClick: onDelete,
124
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {})
125
+ }, "delete-column-button")
126
+ }),
127
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Tooltip, {
128
+ title: "Reorder column settings",
129
+ placement: "top",
130
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_components.DragButton, {
131
+ onMoveUp: onMoveUp,
132
+ onMoveDown: onMoveDown,
133
+ menuSx: {
134
+ '.MuiPaper-root': {
135
+ backgroundColor: (theme)=>theme.palette.background.lighter
136
+ }
137
+ }
138
+ }, "reorder-column-button")
139
+ })
140
+ ]
141
+ })
142
+ ]
143
+ }),
144
+ !isCollapsed && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
145
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ColumnEditor.ColumnEditor, {
146
+ column: column,
147
+ onChange: onChange
148
+ })
149
+ })
150
+ ]
151
+ });
152
+ }
@@ -0,0 +1,108 @@
1
+ // Copyright 2024 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, "ColumnsEditor", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return ColumnsEditor;
21
+ }
22
+ });
23
+ const _jsxruntime = require("react/jsx-runtime");
24
+ const _material = require("@mui/material");
25
+ const _react = require("react");
26
+ const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
27
+ const _components = require("@perses-dev/components");
28
+ const _ColumnEditorContainer = require("./ColumnEditorContainer");
29
+ function _interop_require_default(obj) {
30
+ return obj && obj.__esModule ? obj : {
31
+ default: obj
32
+ };
33
+ }
34
+ function ColumnsEditor({ columnSettings, onChange }) {
35
+ const [columnsCollapsed, setColumnsCollapsed] = (0, _react.useState)(columnSettings.map(()=>true));
36
+ function handleColumnChange(index, column) {
37
+ const updatedColumns = [
38
+ ...columnSettings
39
+ ];
40
+ updatedColumns[index] = column;
41
+ onChange(updatedColumns);
42
+ }
43
+ function handleColumnAdd() {
44
+ const columnName = `column_${Object.keys(columnSettings).length}`;
45
+ const updatedColumns = [
46
+ ...columnSettings
47
+ ];
48
+ updatedColumns.push({
49
+ name: columnName
50
+ });
51
+ onChange(updatedColumns);
52
+ setColumnsCollapsed((prev)=>{
53
+ prev.push(false);
54
+ return [
55
+ ...prev
56
+ ];
57
+ });
58
+ }
59
+ function handleColumnDelete(index) {
60
+ const updatedColumns = [
61
+ ...columnSettings
62
+ ];
63
+ updatedColumns.splice(index, 1);
64
+ onChange(updatedColumns);
65
+ setColumnsCollapsed((prev)=>{
66
+ prev.splice(index, 1);
67
+ return [
68
+ ...prev
69
+ ];
70
+ });
71
+ }
72
+ function handleColumnCollapseExpand(index, collapsed) {
73
+ setColumnsCollapsed((prev)=>{
74
+ prev[index] = collapsed;
75
+ return [
76
+ ...prev
77
+ ];
78
+ });
79
+ }
80
+ (0, _components.useDragAndDropMonitor)({
81
+ elements: columnSettings,
82
+ accessKey: 'name',
83
+ onChange: onChange
84
+ });
85
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
86
+ spacing: 1,
87
+ children: [
88
+ columnSettings.map((column, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_ColumnEditorContainer.ColumnEditorContainer, {
89
+ column: column,
90
+ isCollapsed: columnsCollapsed[i] ?? true,
91
+ onChange: (updatedColumn)=>handleColumnChange(i, updatedColumn),
92
+ onDelete: ()=>handleColumnDelete(i),
93
+ onCollapse: (collapsed)=>handleColumnCollapseExpand(i, collapsed),
94
+ onMoveUp: ()=>onChange((0, _components.handleMoveUp)(column, columnSettings)),
95
+ onMoveDown: ()=>onChange((0, _components.handleMoveDown)(column, columnSettings))
96
+ }, i)),
97
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
98
+ variant: "contained",
99
+ startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {}),
100
+ sx: {
101
+ marginTop: 1
102
+ },
103
+ onClick: handleColumnAdd,
104
+ children: "Add Column Settings"
105
+ })
106
+ ]
107
+ });
108
+ }