@perses-dev/table-plugin 0.8.1 → 0.10.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 (164) hide show
  1. package/__mf/css/async/2341.d3010b86.css +1 -0
  2. package/__mf/css/async/5263.d3010b86.css +1 -0
  3. package/__mf/css/async/6759.d3010b86.css +1 -0
  4. package/__mf/js/{Table.1ddb6c06.js → Table.02a0172e.js} +4 -4
  5. package/__mf/js/async/2178.23b43aaf.js +1 -0
  6. package/__mf/js/async/2472.d6b3b5c6.js +22 -0
  7. package/__mf/js/async/2849.0d68beb5.js +2 -0
  8. package/__mf/js/async/{4075.e2a2c230.js → 4075.98f26cf8.js} +1 -1
  9. package/__mf/js/async/{4238.ea9515aa.js → 4238.8989501f.js} +1 -1
  10. package/__mf/js/async/6377.1f2ba730.js +38 -0
  11. package/__mf/js/async/9830.a2983642.js +7 -0
  12. package/__mf/js/async/__federation_expose_Table.0dbf0d6d.js +1 -0
  13. package/__mf/js/{main.688de0b9.js → main.f7b12b00.js} +4 -4
  14. package/lib/Table.d.ts +2 -2
  15. package/lib/Table.d.ts.map +1 -1
  16. package/lib/Table.js +2 -6
  17. package/lib/Table.js.map +1 -1
  18. package/lib/cjs/Table.js +9 -13
  19. package/lib/cjs/components/CellsEditor/CellsEditor.js +30 -0
  20. package/lib/cjs/{CellsEditor → components/CellsEditor}/index.js +0 -1
  21. package/lib/cjs/components/ColumnsEditor/ColumnEditor.js +241 -0
  22. package/lib/cjs/{CellsEditor/CellEditor.js → components/ConditionalPanel.js} +167 -197
  23. package/lib/cjs/components/TablePanel.js +576 -0
  24. package/lib/cjs/{TableSettingsEditor.js → components/TableSettingsEditor.js} +32 -4
  25. package/lib/cjs/components/index.js +37 -0
  26. package/lib/cjs/index.js +2 -9
  27. package/lib/cjs/models/index.js +31 -0
  28. package/lib/cjs/{table-model.js → models/model.js} +1 -12
  29. package/lib/cjs/models/table-model.js +252 -0
  30. package/lib/{CellsEditor → components/CellsEditor}/CellsEditor.d.ts +1 -1
  31. package/lib/components/CellsEditor/CellsEditor.d.ts.map +1 -0
  32. package/lib/components/CellsEditor/CellsEditor.js +22 -0
  33. package/lib/components/CellsEditor/CellsEditor.js.map +1 -0
  34. package/lib/components/CellsEditor/index.d.ts +2 -0
  35. package/lib/components/CellsEditor/index.d.ts.map +1 -0
  36. package/lib/{CellsEditor → components/CellsEditor}/index.js +0 -1
  37. package/lib/components/CellsEditor/index.js.map +1 -0
  38. package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnEditor.d.ts +1 -1
  39. package/lib/components/ColumnsEditor/ColumnEditor.d.ts.map +1 -0
  40. package/lib/components/ColumnsEditor/ColumnEditor.js +233 -0
  41. package/lib/components/ColumnsEditor/ColumnEditor.js.map +1 -0
  42. package/lib/components/ColumnsEditor/ColumnEditorContainer.d.ts.map +1 -0
  43. package/lib/components/ColumnsEditor/ColumnEditorContainer.js.map +1 -0
  44. package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnsEditor.d.ts +1 -1
  45. package/lib/components/ColumnsEditor/ColumnsEditor.d.ts.map +1 -0
  46. package/lib/components/ColumnsEditor/ColumnsEditor.js.map +1 -0
  47. package/lib/components/ColumnsEditor/index.d.ts.map +1 -0
  48. package/lib/components/ColumnsEditor/index.js.map +1 -0
  49. package/lib/components/ConditionalPanel.d.ts +15 -0
  50. package/lib/components/ConditionalPanel.d.ts.map +1 -0
  51. package/lib/{CellsEditor/CellEditor.js → components/ConditionalPanel.js} +159 -197
  52. package/lib/components/ConditionalPanel.js.map +1 -0
  53. package/lib/components/EmbeddedPanel.d.ts.map +1 -0
  54. package/lib/components/EmbeddedPanel.js.map +1 -0
  55. package/lib/{TableCellsEditor.d.ts → components/TableCellsEditor.d.ts} +1 -1
  56. package/lib/components/TableCellsEditor.d.ts.map +1 -0
  57. package/lib/components/TableCellsEditor.js.map +1 -0
  58. package/lib/{TableColumnsEditor.d.ts → components/TableColumnsEditor.d.ts} +1 -1
  59. package/lib/components/TableColumnsEditor.d.ts.map +1 -0
  60. package/lib/components/TableColumnsEditor.js.map +1 -0
  61. package/lib/{TablePanel.d.ts → components/TablePanel.d.ts} +1 -1
  62. package/lib/components/TablePanel.d.ts.map +1 -0
  63. package/lib/components/TablePanel.js +560 -0
  64. package/lib/components/TablePanel.js.map +1 -0
  65. package/lib/{TableSettingsEditor.d.ts → components/TableSettingsEditor.d.ts} +1 -1
  66. package/lib/components/TableSettingsEditor.d.ts.map +1 -0
  67. package/lib/{TableSettingsEditor.js → components/TableSettingsEditor.js} +32 -4
  68. package/lib/components/TableSettingsEditor.js.map +1 -0
  69. package/lib/{TableTransformsEditor.d.ts → components/TableTransformsEditor.d.ts} +1 -1
  70. package/lib/components/TableTransformsEditor.d.ts.map +1 -0
  71. package/lib/components/TableTransformsEditor.js.map +1 -0
  72. package/lib/components/index.d.ts +9 -0
  73. package/lib/components/index.d.ts.map +1 -0
  74. package/lib/components/index.js +22 -0
  75. package/lib/components/index.js.map +1 -0
  76. package/lib/index.d.ts +2 -9
  77. package/lib/index.d.ts.map +1 -1
  78. package/lib/index.js +2 -9
  79. package/lib/index.js.map +1 -1
  80. package/lib/models/index.d.ts +3 -0
  81. package/lib/models/index.d.ts.map +1 -0
  82. package/lib/{table-model.js → models/index.js} +4 -9
  83. package/lib/models/index.js.map +1 -0
  84. package/lib/models/model.d.ts.map +1 -0
  85. package/lib/models/model.js +15 -0
  86. package/lib/models/model.js.map +1 -0
  87. package/lib/{table-model.d.ts → models/table-model.d.ts} +24 -1
  88. package/lib/models/table-model.d.ts.map +1 -0
  89. package/lib/models/table-model.js +233 -0
  90. package/lib/models/table-model.js.map +1 -0
  91. package/mf-manifest.json +21 -22
  92. package/mf-stats.json +22 -23
  93. package/package.json +6 -6
  94. package/__mf/css/async/2341.cbbd94a8.css +0 -1
  95. package/__mf/css/async/5263.cbbd94a8.css +0 -1
  96. package/__mf/css/async/6759.cbbd94a8.css +0 -1
  97. package/__mf/js/async/3391.62c7afd4.js +0 -73
  98. package/__mf/js/async/4300.fc319dfb.js +0 -38
  99. package/__mf/js/async/4368.3e460b07.js +0 -1
  100. package/__mf/js/async/5061.85655462.js +0 -2
  101. package/__mf/js/async/5377.6522c49a.js +0 -1
  102. package/__mf/js/async/8313.b86a056a.js +0 -7
  103. package/__mf/js/async/__federation_expose_Table.3668e352.js +0 -1
  104. package/lib/CellsEditor/CellEditor.d.ts +0 -10
  105. package/lib/CellsEditor/CellEditor.d.ts.map +0 -1
  106. package/lib/CellsEditor/CellEditor.js.map +0 -1
  107. package/lib/CellsEditor/CellsEditor.d.ts.map +0 -1
  108. package/lib/CellsEditor/CellsEditor.js +0 -123
  109. package/lib/CellsEditor/CellsEditor.js.map +0 -1
  110. package/lib/CellsEditor/index.d.ts +0 -3
  111. package/lib/CellsEditor/index.d.ts.map +0 -1
  112. package/lib/CellsEditor/index.js.map +0 -1
  113. package/lib/ColumnsEditor/ColumnEditor.d.ts.map +0 -1
  114. package/lib/ColumnsEditor/ColumnEditor.js +0 -213
  115. package/lib/ColumnsEditor/ColumnEditor.js.map +0 -1
  116. package/lib/ColumnsEditor/ColumnEditorContainer.d.ts.map +0 -1
  117. package/lib/ColumnsEditor/ColumnEditorContainer.js.map +0 -1
  118. package/lib/ColumnsEditor/ColumnsEditor.d.ts.map +0 -1
  119. package/lib/ColumnsEditor/ColumnsEditor.js.map +0 -1
  120. package/lib/ColumnsEditor/index.d.ts.map +0 -1
  121. package/lib/ColumnsEditor/index.js.map +0 -1
  122. package/lib/EmbeddedPanel.d.ts.map +0 -1
  123. package/lib/EmbeddedPanel.js.map +0 -1
  124. package/lib/TableCellsEditor.d.ts.map +0 -1
  125. package/lib/TableCellsEditor.js.map +0 -1
  126. package/lib/TableColumnsEditor.d.ts.map +0 -1
  127. package/lib/TableColumnsEditor.js.map +0 -1
  128. package/lib/TablePanel.d.ts.map +0 -1
  129. package/lib/TablePanel.js +0 -325
  130. package/lib/TablePanel.js.map +0 -1
  131. package/lib/TableSettingsEditor.d.ts.map +0 -1
  132. package/lib/TableSettingsEditor.js.map +0 -1
  133. package/lib/TableTransformsEditor.d.ts.map +0 -1
  134. package/lib/TableTransformsEditor.js.map +0 -1
  135. package/lib/cjs/CellsEditor/CellsEditor.js +0 -136
  136. package/lib/cjs/ColumnsEditor/ColumnEditor.js +0 -221
  137. package/lib/cjs/TablePanel.js +0 -341
  138. package/lib/cjs/model.js +0 -4
  139. package/lib/model.d.ts.map +0 -1
  140. package/lib/model.js +0 -3
  141. package/lib/model.js.map +0 -1
  142. package/lib/table-model.d.ts.map +0 -1
  143. package/lib/table-model.js.map +0 -1
  144. /package/__mf/js/async/{3391.62c7afd4.js.LICENSE.txt → 2472.d6b3b5c6.js.LICENSE.txt} +0 -0
  145. /package/__mf/js/async/{5061.85655462.js.LICENSE.txt → 2849.0d68beb5.js.LICENSE.txt} +0 -0
  146. /package/__mf/js/async/{8313.b86a056a.js.LICENSE.txt → 9830.a2983642.js.LICENSE.txt} +0 -0
  147. /package/lib/cjs/{ColumnsEditor → components/ColumnsEditor}/ColumnEditorContainer.js +0 -0
  148. /package/lib/cjs/{ColumnsEditor → components/ColumnsEditor}/ColumnsEditor.js +0 -0
  149. /package/lib/cjs/{ColumnsEditor → components/ColumnsEditor}/index.js +0 -0
  150. /package/lib/cjs/{EmbeddedPanel.js → components/EmbeddedPanel.js} +0 -0
  151. /package/lib/cjs/{TableCellsEditor.js → components/TableCellsEditor.js} +0 -0
  152. /package/lib/cjs/{TableColumnsEditor.js → components/TableColumnsEditor.js} +0 -0
  153. /package/lib/cjs/{TableTransformsEditor.js → components/TableTransformsEditor.js} +0 -0
  154. /package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnEditorContainer.d.ts +0 -0
  155. /package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnEditorContainer.js +0 -0
  156. /package/lib/{ColumnsEditor → components/ColumnsEditor}/ColumnsEditor.js +0 -0
  157. /package/lib/{ColumnsEditor → components/ColumnsEditor}/index.d.ts +0 -0
  158. /package/lib/{ColumnsEditor → components/ColumnsEditor}/index.js +0 -0
  159. /package/lib/{EmbeddedPanel.d.ts → components/EmbeddedPanel.d.ts} +0 -0
  160. /package/lib/{EmbeddedPanel.js → components/EmbeddedPanel.js} +0 -0
  161. /package/lib/{TableCellsEditor.js → components/TableCellsEditor.js} +0 -0
  162. /package/lib/{TableColumnsEditor.js → components/TableColumnsEditor.js} +0 -0
  163. /package/lib/{TableTransformsEditor.js → components/TableTransformsEditor.js} +0 -0
  164. /package/lib/{model.d.ts → models/model.d.ts} +0 -0
package/lib/cjs/index.js CHANGED
@@ -9,16 +9,9 @@ Object.defineProperty(exports, "getPluginModule", {
9
9
  }
10
10
  });
11
11
  const _getPluginModule = require("./getPluginModule");
12
- _export_star(require("./CellsEditor"), exports);
13
- _export_star(require("./ColumnsEditor"), exports);
14
12
  _export_star(require("./Table"), exports);
15
- _export_star(require("./TableCellsEditor"), exports);
16
- _export_star(require("./TableColumnsEditor"), exports);
17
- _export_star(require("./TablePanel"), exports);
18
- _export_star(require("./TableSettingsEditor"), exports);
19
- _export_star(require("./TableTransformsEditor"), exports);
20
- _export_star(require("./model"), exports);
21
- _export_star(require("./table-model"), exports);
13
+ _export_star(require("./components"), exports);
14
+ _export_star(require("./models"), exports);
22
15
  function _export_star(from, to) {
23
16
  Object.keys(from).forEach(function(k) {
24
17
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -0,0 +1,31 @@
1
+ // Copyright 2025 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("./model"), exports);
18
+ _export_star(require("./table-model"), 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
+ }
@@ -1,4 +1,4 @@
1
- // Copyright 2024 The Perses Authors
1
+ // Copyright 2025 The Perses Authors
2
2
  // Licensed under the Apache License, Version 2.0 (the "License");
3
3
  // you may not use this file except in compliance with the License.
4
4
  // You may obtain a copy of the License at
@@ -14,14 +14,3 @@
14
14
  Object.defineProperty(exports, "__esModule", {
15
15
  value: true
16
16
  });
17
- Object.defineProperty(exports, "createInitialTableOptions", {
18
- enumerable: true,
19
- get: function() {
20
- return createInitialTableOptions;
21
- }
22
- });
23
- function createInitialTableOptions() {
24
- return {
25
- density: 'standard'
26
- };
27
- }
@@ -0,0 +1,252 @@
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
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ createInitialTableOptions: function() {
25
+ return createInitialTableOptions;
26
+ },
27
+ evaluateCondition: function() {
28
+ return evaluateCondition;
29
+ },
30
+ evaluateConditionalFormatting: function() {
31
+ return evaluateConditionalFormatting;
32
+ },
33
+ formatCellDisplay: function() {
34
+ return formatCellDisplay;
35
+ },
36
+ renderConditionEditor: function() {
37
+ return renderConditionEditor;
38
+ }
39
+ });
40
+ const _react = /*#__PURE__*/ _interop_require_default(require("react"));
41
+ const _material = require("@mui/material");
42
+ function _interop_require_default(obj) {
43
+ return obj && obj.__esModule ? obj : {
44
+ default: obj
45
+ };
46
+ }
47
+ function createInitialTableOptions() {
48
+ return {
49
+ density: 'standard',
50
+ enableFiltering: true
51
+ };
52
+ }
53
+ function formatCellDisplay(value, setting, defaultText) {
54
+ const baseText = setting.text || defaultText || String(value);
55
+ const displayText = `${setting.prefix ?? ''}${baseText}${setting.suffix ?? ''}`;
56
+ return {
57
+ text: displayText,
58
+ textColor: setting.textColor,
59
+ backgroundColor: setting.backgroundColor
60
+ };
61
+ }
62
+ function evaluateCondition(condition, value) {
63
+ switch(condition.kind){
64
+ case 'Value':
65
+ return condition.spec?.value === String(value);
66
+ case 'Range':
67
+ {
68
+ if (Number.isNaN(Number(value))) return false;
69
+ const numericValue = Number(value);
70
+ // Both min and max defined
71
+ if (condition.spec?.min !== undefined && condition.spec?.max !== undefined) {
72
+ return numericValue >= +condition.spec.min && numericValue <= +condition.spec.max;
73
+ }
74
+ // Only min defined
75
+ if (condition.spec?.min !== undefined) {
76
+ return numericValue >= +condition.spec.min;
77
+ }
78
+ // Only max defined
79
+ if (condition.spec?.max !== undefined) {
80
+ return numericValue <= +condition.spec.max;
81
+ }
82
+ return false;
83
+ }
84
+ case 'Regex':
85
+ if (!condition.spec?.expr) return false;
86
+ try {
87
+ const regex = new RegExp(condition.spec.expr);
88
+ return regex.test(String(value));
89
+ } catch {
90
+ return false; // Invalid regex
91
+ }
92
+ case 'Misc':
93
+ switch(condition.spec?.value){
94
+ case 'empty':
95
+ return value === '';
96
+ case 'null':
97
+ return value === null || value === undefined;
98
+ case 'NaN':
99
+ return Number.isNaN(value);
100
+ case 'true':
101
+ return value === true;
102
+ case 'false':
103
+ return value === false;
104
+ default:
105
+ return false;
106
+ }
107
+ default:
108
+ return false;
109
+ }
110
+ }
111
+ function evaluateConditionalFormatting(value, settings) {
112
+ for (const setting of settings){
113
+ if (evaluateCondition(setting.condition, value)) {
114
+ // Handle special default text cases
115
+ let defaultText;
116
+ if (setting.condition.kind === 'Misc') {
117
+ switch(setting.condition.spec?.value){
118
+ case 'null':
119
+ defaultText = 'null';
120
+ break;
121
+ case 'NaN':
122
+ defaultText = 'NaN';
123
+ break;
124
+ }
125
+ }
126
+ return formatCellDisplay(value, setting, defaultText);
127
+ }
128
+ }
129
+ return undefined; // No conditions matched
130
+ }
131
+ function renderConditionEditor(condition, onChange, size = 'small') {
132
+ if (condition.kind === 'Value') {
133
+ return _react.default.createElement(_material.TextField, {
134
+ label: 'Value',
135
+ placeholder: 'Exact value',
136
+ value: condition.spec?.value ?? '',
137
+ onChange: (e)=>onChange({
138
+ ...condition,
139
+ spec: {
140
+ value: e.target.value
141
+ }
142
+ }),
143
+ fullWidth: true,
144
+ size: size
145
+ });
146
+ } else if (condition.kind === 'Range') {
147
+ return _react.default.createElement(_material.Stack, {
148
+ gap: 1,
149
+ direction: 'row'
150
+ }, [
151
+ _react.default.createElement(_material.TextField, {
152
+ key: 'min',
153
+ label: 'From',
154
+ placeholder: 'Start of range',
155
+ value: condition.spec?.min ?? '',
156
+ onChange: (e)=>onChange({
157
+ ...condition,
158
+ spec: {
159
+ ...condition.spec,
160
+ min: +e.target.value
161
+ }
162
+ }),
163
+ fullWidth: true,
164
+ size: size
165
+ }),
166
+ _react.default.createElement(_material.TextField, {
167
+ key: 'max',
168
+ label: 'To',
169
+ placeholder: 'End of range (inclusive)',
170
+ value: condition.spec?.max ?? '',
171
+ onChange: (e)=>onChange({
172
+ ...condition,
173
+ spec: {
174
+ ...condition.spec,
175
+ max: +e.target.value
176
+ }
177
+ }),
178
+ fullWidth: true,
179
+ size: size
180
+ })
181
+ ]);
182
+ } else if (condition.kind === 'Regex') {
183
+ return _react.default.createElement(_material.TextField, {
184
+ label: 'Regular Expression',
185
+ placeholder: 'JavaScript regular expression',
186
+ value: condition.spec?.expr ?? '',
187
+ onChange: (e)=>onChange({
188
+ ...condition,
189
+ spec: {
190
+ expr: e.target.value
191
+ }
192
+ }),
193
+ fullWidth: true,
194
+ size: size
195
+ });
196
+ } else if (condition.kind === 'Misc') {
197
+ const options = [
198
+ {
199
+ value: 'empty',
200
+ label: 'Empty',
201
+ caption: 'Matches empty string'
202
+ },
203
+ {
204
+ value: 'null',
205
+ label: 'Null',
206
+ caption: 'Matches null or undefined'
207
+ },
208
+ {
209
+ value: 'NaN',
210
+ label: 'NaN',
211
+ caption: 'Matches Not a Number value'
212
+ },
213
+ {
214
+ value: 'true',
215
+ label: 'True',
216
+ caption: 'Matches true boolean'
217
+ },
218
+ {
219
+ value: 'false',
220
+ label: 'False',
221
+ caption: 'Matches false boolean'
222
+ }
223
+ ];
224
+ return _react.default.createElement(_material.TextField, {
225
+ select: true,
226
+ label: 'Value',
227
+ value: condition.spec?.value ?? '',
228
+ onChange: (e)=>onChange({
229
+ ...condition,
230
+ spec: {
231
+ value: e.target.value
232
+ }
233
+ }),
234
+ fullWidth: true,
235
+ size: size
236
+ }, options.map((option)=>_react.default.createElement(_material.MenuItem, {
237
+ key: option.value,
238
+ value: option.value
239
+ }, _react.default.createElement(_material.Stack, {
240
+ key: 'stack'
241
+ }, [
242
+ _react.default.createElement(_material.Typography, {
243
+ key: 'title'
244
+ }, option.label),
245
+ _react.default.createElement(_material.Typography, {
246
+ key: 'caption',
247
+ variant: 'caption'
248
+ }, option.caption)
249
+ ]))));
250
+ }
251
+ return null;
252
+ }
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from 'react';
2
- import { CellSettings } from '../table-model';
2
+ import { CellSettings } from '../../models';
3
3
  export interface CellsEditorProps {
4
4
  cellSettings: CellSettings[];
5
5
  onChange: (cellOptions: CellSettings[]) => void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CellsEditor.d.ts","sourceRoot":"","sources":["../../../../src/components/CellsEditor/CellsEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,QAAQ,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CACjD;AAED,wBAAgB,WAAW,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,YAAY,CAOtF"}
@@ -0,0 +1,22 @@
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
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { ConditionalPanel } from '../ConditionalPanel';
15
+ export function CellsEditor({ cellSettings, onChange }) {
16
+ return /*#__PURE__*/ _jsx(ConditionalPanel, {
17
+ cellSettings: cellSettings,
18
+ onChange: (updatedCellSettings)=>onChange(updatedCellSettings || [])
19
+ });
20
+ }
21
+
22
+ //# sourceMappingURL=CellsEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/CellsEditor/CellsEditor.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement } from 'react';\nimport { CellSettings } from '../../models';\nimport { ConditionalPanel } from '../ConditionalPanel';\n\nexport interface CellsEditorProps {\n cellSettings: CellSettings[];\n onChange: (cellOptions: CellSettings[]) => void;\n}\n\nexport function CellsEditor({ cellSettings, onChange }: CellsEditorProps): ReactElement {\n return (\n <ConditionalPanel\n cellSettings={cellSettings}\n onChange={(updatedCellSettings) => onChange(updatedCellSettings || [])}\n />\n );\n}\n"],"names":["ConditionalPanel","CellsEditor","cellSettings","onChange","updatedCellSettings"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAIjC,SAASA,gBAAgB,QAAQ,sBAAsB;AAOvD,OAAO,SAASC,YAAY,EAAEC,YAAY,EAAEC,QAAQ,EAAoB;IACtE,qBACE,KAACH;QACCE,cAAcA;QACdC,UAAU,CAACC,sBAAwBD,SAASC,uBAAuB,EAAE;;AAG3E"}
@@ -0,0 +1,2 @@
1
+ export * from './CellsEditor';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CellsEditor/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC"}
@@ -10,7 +10,6 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export * from './CellEditor';
14
13
  export * from './CellsEditor';
15
14
 
16
15
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/CellsEditor/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './CellsEditor';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,gBAAgB"}
@@ -1,6 +1,6 @@
1
1
  import { StackProps } from '@mui/material';
2
2
  import { ReactElement } from 'react';
3
- import { ColumnSettings } from '../table-model';
3
+ import { ColumnSettings } from '../../models';
4
4
  type OmittedMuiProps = 'children' | 'value' | 'onChange';
5
5
  export interface ColumnEditorProps extends Omit<StackProps, OmittedMuiProps> {
6
6
  column: ColumnSettings;
@@ -0,0 +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;AAY/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQ9C,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,CAkL7F"}
@@ -0,0 +1,233 @@
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
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Button, ButtonGroup, Stack, Switch, TextField } from '@mui/material';
15
+ import { useState } from 'react';
16
+ import { AlignSelector, FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup, SortSelectorButtons } from '@perses-dev/components';
17
+ import { PluginKindSelect } from '@perses-dev/plugin-system';
18
+ import { ConditionalPanel } from '../ConditionalPanel';
19
+ const DEFAULT_FORMAT = {
20
+ unit: 'decimal',
21
+ shortValues: true
22
+ };
23
+ export function ColumnEditor({ column, onChange, ...others }) {
24
+ const [width, setWidth] = useState(column.width === undefined || column.width === 'auto' ? 100 : column.width);
25
+ return /*#__PURE__*/ _jsxs(Stack, {
26
+ ...others,
27
+ children: [
28
+ /*#__PURE__*/ _jsxs(OptionsEditorGrid, {
29
+ children: [
30
+ /*#__PURE__*/ _jsx(OptionsEditorColumn, {
31
+ children: /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
32
+ title: "Column",
33
+ children: [
34
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
35
+ label: "Name*",
36
+ control: /*#__PURE__*/ _jsx(TextField, {
37
+ value: column.name,
38
+ onChange: (e)=>onChange({
39
+ ...column,
40
+ name: e.target.value
41
+ }),
42
+ required: true
43
+ })
44
+ }),
45
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
46
+ label: "Header",
47
+ control: /*#__PURE__*/ _jsx(TextField, {
48
+ value: column.header ?? '',
49
+ onChange: (e)=>onChange({
50
+ ...column,
51
+ header: e.target.value ? e.target.value : undefined
52
+ })
53
+ })
54
+ }),
55
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
56
+ label: "Header Tooltip",
57
+ control: /*#__PURE__*/ _jsx(TextField, {
58
+ value: column.headerDescription ?? '',
59
+ onChange: (e)=>onChange({
60
+ ...column,
61
+ headerDescription: e.target.value ? e.target.value : undefined
62
+ })
63
+ })
64
+ }),
65
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
66
+ label: "Cell Tooltip",
67
+ control: /*#__PURE__*/ _jsx(TextField, {
68
+ value: column.cellDescription ?? '',
69
+ onChange: (e)=>onChange({
70
+ ...column,
71
+ cellDescription: e.target.value ? e.target.value : undefined
72
+ })
73
+ })
74
+ }),
75
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
76
+ label: "Enable sorting",
77
+ control: /*#__PURE__*/ _jsx(Switch, {
78
+ checked: column.enableSorting ?? false,
79
+ onChange: (e)=>onChange({
80
+ ...column,
81
+ enableSorting: e.target.checked
82
+ })
83
+ })
84
+ }),
85
+ column.enableSorting && /*#__PURE__*/ _jsx(OptionsEditorControl, {
86
+ label: "Default Sort",
87
+ control: /*#__PURE__*/ _jsx(SortSelectorButtons, {
88
+ size: "medium",
89
+ value: column.sort,
90
+ sx: {
91
+ margin: 0.5
92
+ },
93
+ onChange: (sort)=>onChange({
94
+ ...column,
95
+ sort: sort
96
+ })
97
+ })
98
+ })
99
+ ]
100
+ })
101
+ }),
102
+ /*#__PURE__*/ _jsx(OptionsEditorColumn, {
103
+ children: /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
104
+ title: "Visual",
105
+ children: [
106
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
107
+ label: "Show column",
108
+ control: /*#__PURE__*/ _jsx(Switch, {
109
+ checked: !(column.hide ?? false),
110
+ onChange: (e)=>onChange({
111
+ ...column,
112
+ hide: !e.target.checked
113
+ })
114
+ })
115
+ }),
116
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
117
+ label: "Display",
118
+ control: /*#__PURE__*/ _jsxs(ButtonGroup, {
119
+ "aria-label": "Display",
120
+ size: "small",
121
+ children: [
122
+ /*#__PURE__*/ _jsx(Button, {
123
+ variant: !column.plugin ? 'contained' : 'outlined',
124
+ onClick: ()=>onChange({
125
+ ...column,
126
+ plugin: undefined
127
+ }),
128
+ children: "Text"
129
+ }),
130
+ /*#__PURE__*/ _jsx(Button, {
131
+ variant: column.plugin ? 'contained' : 'outlined',
132
+ onClick: ()=>onChange({
133
+ ...column,
134
+ plugin: {
135
+ kind: 'StatChart',
136
+ spec: {}
137
+ }
138
+ }),
139
+ children: "Embedded Panel"
140
+ })
141
+ ]
142
+ })
143
+ }),
144
+ column.plugin ? /*#__PURE__*/ _jsx(OptionsEditorControl, {
145
+ label: "Panel Type",
146
+ control: /*#__PURE__*/ _jsx(PluginKindSelect, {
147
+ pluginTypes: [
148
+ 'Panel'
149
+ ],
150
+ value: {
151
+ type: 'Panel',
152
+ kind: column.plugin.kind
153
+ },
154
+ onChange: (event)=>onChange({
155
+ ...column,
156
+ plugin: {
157
+ kind: event.kind,
158
+ spec: {}
159
+ }
160
+ })
161
+ })
162
+ }) : /*#__PURE__*/ _jsx(FormatControls, {
163
+ value: column.format ?? DEFAULT_FORMAT,
164
+ onChange: (newFormat)=>onChange({
165
+ ...column,
166
+ format: newFormat
167
+ })
168
+ }),
169
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
170
+ label: "Alignment",
171
+ control: /*#__PURE__*/ _jsx(AlignSelector, {
172
+ size: "small",
173
+ value: column.align ?? 'left',
174
+ onChange: (align)=>onChange({
175
+ ...column,
176
+ align: align
177
+ })
178
+ })
179
+ }),
180
+ /*#__PURE__*/ _jsx(OptionsEditorControl, {
181
+ label: "Custom width",
182
+ control: /*#__PURE__*/ _jsx(Switch, {
183
+ checked: column.width !== undefined && column.width !== 'auto',
184
+ onChange: (e)=>onChange({
185
+ ...column,
186
+ width: e.target.checked ? width : 'auto'
187
+ })
188
+ })
189
+ }),
190
+ column.width !== undefined && column.width !== 'auto' && /*#__PURE__*/ _jsx(OptionsEditorControl, {
191
+ label: "Width",
192
+ control: /*#__PURE__*/ _jsx(TextField, {
193
+ type: "number",
194
+ value: width,
195
+ slotProps: {
196
+ htmlInput: {
197
+ min: 1
198
+ }
199
+ },
200
+ onChange: (e)=>{
201
+ setWidth(+e.target.value);
202
+ onChange({
203
+ ...column,
204
+ width: +e.target.value
205
+ });
206
+ }
207
+ })
208
+ })
209
+ ]
210
+ })
211
+ })
212
+ ]
213
+ }),
214
+ /*#__PURE__*/ _jsx(Stack, {
215
+ sx: {
216
+ px: 8
217
+ },
218
+ children: /*#__PURE__*/ _jsx(OptionsEditorGroup, {
219
+ title: "Conditional Cell Format",
220
+ children: /*#__PURE__*/ _jsx(ConditionalPanel, {
221
+ cellSettings: column.cellSettings,
222
+ onChange: (cellSettings)=>onChange({
223
+ ...column,
224
+ cellSettings
225
+ })
226
+ })
227
+ })
228
+ })
229
+ ]
230
+ });
231
+ }
232
+
233
+ //# sourceMappingURL=ColumnEditor.js.map