@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.
- package/LICENSE +201 -0
- package/README.md +41 -0
- package/__mf/css/async/2341.cbbd94a8.css +1 -0
- package/__mf/css/async/5263.cbbd94a8.css +1 -0
- package/__mf/css/async/6759.cbbd94a8.css +1 -0
- package/__mf/css/async/8433.cbbd94a8.css +1 -0
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/6487.f255ba88.js +5 -0
- package/__mf/js/Table.510470af.js +5 -0
- package/__mf/js/async/1620.ed8d9b3d.js +2 -0
- package/__mf/js/async/1620.ed8d9b3d.js.LICENSE.txt +9 -0
- package/__mf/js/async/1640.ff18956a.js +1 -0
- package/__mf/js/async/1722.586085f2.js +1 -0
- package/__mf/js/async/1964.979a7101.js +2 -0
- package/__mf/js/async/1964.979a7101.js.LICENSE.txt +9 -0
- package/__mf/js/async/1996.e0e5fb2a.js +2 -0
- package/__mf/js/async/1996.e0e5fb2a.js.LICENSE.txt +24 -0
- package/__mf/js/async/232.ab228ab3.js +1 -0
- package/__mf/js/async/2399.8ceb88c6.js +23 -0
- package/__mf/js/async/2641.78a9e888.js +1 -0
- package/__mf/js/async/2651.7c8030f0.js +1 -0
- package/__mf/js/async/3001.51d0062c.js +1 -0
- package/__mf/js/async/3224.fbb884ab.js +1 -0
- package/__mf/js/async/3598.66df4cef.js +1 -0
- package/__mf/js/async/3660.4a5855e1.js +23 -0
- package/__mf/js/async/3893.f1c71cae.js +1 -0
- package/__mf/js/async/3960.c992ac30.js +2 -0
- package/__mf/js/async/3960.c992ac30.js.LICENSE.txt +8 -0
- package/__mf/js/async/4062.0dd7dc24.js +1 -0
- package/__mf/js/async/4075.4fb81a28.js +1 -0
- package/__mf/js/async/4238.e22a8e1b.js +1 -0
- package/__mf/js/async/4446.9a215492.js +1 -0
- package/__mf/js/async/468.cca77551.js +110 -0
- package/__mf/js/async/468.cca77551.js.LICENSE.txt +27 -0
- package/__mf/js/async/4741.ceabfbaa.js +38 -0
- package/__mf/js/async/52.77f8a241.js +2 -0
- package/__mf/js/async/52.77f8a241.js.LICENSE.txt +37 -0
- package/__mf/js/async/5214.19ee9ad8.js +1 -0
- package/__mf/js/async/5377.05ab91aa.js +1 -0
- package/__mf/js/async/5409.3c667e6d.js +1 -0
- package/__mf/js/async/5662.d6ae2721.js +1 -0
- package/__mf/js/async/5767.6be60775.js +1 -0
- package/__mf/js/async/5912.b68e4631.js +1 -0
- package/__mf/js/async/5981.95116879.js +2 -0
- package/__mf/js/async/5981.95116879.js.LICENSE.txt +8 -0
- package/__mf/js/async/5998.ac755fc8.js +73 -0
- package/__mf/js/async/5998.ac755fc8.js.LICENSE.txt +19 -0
- package/__mf/js/async/6292.20be7eae.js +1 -0
- package/__mf/js/async/6333.35401612.js +2 -0
- package/__mf/js/async/6333.35401612.js.LICENSE.txt +9 -0
- package/__mf/js/async/654.fd64ef4b.js +1 -0
- package/__mf/js/async/6757.5675a614.js +7 -0
- package/__mf/js/async/6757.5675a614.js.LICENSE.txt +21 -0
- package/__mf/js/async/6770.84690346.js +1 -0
- package/__mf/js/async/6884.5426473f.js +1 -0
- package/__mf/js/async/694.4b146780.js +1 -0
- package/__mf/js/async/738.e2fbbd72.js +1 -0
- package/__mf/js/async/7606.4ba8e3ec.js +1 -0
- package/__mf/js/async/7740.dcade8b6.js +1 -0
- package/__mf/js/async/8444.d0d247d8.js +1 -0
- package/__mf/js/async/8488.d5eddfc6.js +1 -0
- package/__mf/js/async/8807.f0e4209b.js +1 -0
- package/__mf/js/async/894.1c4bbdb5.js +1 -0
- package/__mf/js/async/9010.8332598b.js +1 -0
- package/__mf/js/async/9173.00408de3.js +2 -0
- package/__mf/js/async/9173.00408de3.js.LICENSE.txt +19 -0
- package/__mf/js/async/9509.e6075bf0.js +1 -0
- package/__mf/js/async/__federation_expose_Table.0b081d4a.js +1 -0
- package/__mf/js/async/lib-router.d60ae988.js +2 -0
- package/__mf/js/async/lib-router.d60ae988.js.LICENSE.txt +32 -0
- package/__mf/js/main.fa5edfce.js +1 -0
- package/lib/CellsEditor/CellEditor.d.ts +10 -0
- package/lib/CellsEditor/CellEditor.d.ts.map +1 -0
- package/lib/CellsEditor/CellEditor.js +372 -0
- package/lib/CellsEditor/CellEditor.js.map +1 -0
- package/lib/CellsEditor/CellsEditor.d.ts +8 -0
- package/lib/CellsEditor/CellsEditor.d.ts.map +1 -0
- package/lib/CellsEditor/CellsEditor.js +123 -0
- package/lib/CellsEditor/CellsEditor.js.map +1 -0
- package/lib/CellsEditor/index.d.ts +3 -0
- package/lib/CellsEditor/index.d.ts.map +1 -0
- package/lib/CellsEditor/index.js +16 -0
- package/lib/CellsEditor/index.js.map +1 -0
- package/lib/ColumnsEditor/ColumnEditor.d.ts +11 -0
- package/lib/ColumnsEditor/ColumnEditor.d.ts.map +1 -0
- package/lib/ColumnsEditor/ColumnEditor.js +213 -0
- package/lib/ColumnsEditor/ColumnEditor.js.map +1 -0
- package/lib/ColumnsEditor/ColumnEditorContainer.d.ts +11 -0
- package/lib/ColumnsEditor/ColumnEditorContainer.d.ts.map +1 -0
- package/lib/ColumnsEditor/ColumnEditorContainer.js +139 -0
- package/lib/ColumnsEditor/ColumnEditorContainer.js.map +1 -0
- package/lib/ColumnsEditor/ColumnsEditor.d.ts +8 -0
- package/lib/ColumnsEditor/ColumnsEditor.d.ts.map +1 -0
- package/lib/ColumnsEditor/ColumnsEditor.js +95 -0
- package/lib/ColumnsEditor/ColumnsEditor.js.map +1 -0
- package/lib/ColumnsEditor/index.d.ts +4 -0
- package/lib/ColumnsEditor/index.d.ts.map +1 -0
- package/lib/ColumnsEditor/index.js +17 -0
- package/lib/ColumnsEditor/index.js.map +1 -0
- package/lib/EmbeddedPanel.d.ts +10 -0
- package/lib/EmbeddedPanel.d.ts.map +1 -0
- package/lib/EmbeddedPanel.js +39 -0
- package/lib/EmbeddedPanel.js.map +1 -0
- package/lib/Table.d.ts +8 -0
- package/lib/Table.d.ts.map +1 -0
- package/lib/Table.js +48 -0
- package/lib/Table.js.map +1 -0
- package/lib/TableCellsEditor.d.ts +6 -0
- package/lib/TableCellsEditor.d.ts.map +1 -0
- package/lib/TableCellsEditor.js +28 -0
- package/lib/TableCellsEditor.js.map +1 -0
- package/lib/TableColumnsEditor.d.ts +6 -0
- package/lib/TableColumnsEditor.d.ts.map +1 -0
- package/lib/TableColumnsEditor.js +28 -0
- package/lib/TableColumnsEditor.js.map +1 -0
- package/lib/TablePanel.d.ts +10 -0
- package/lib/TablePanel.d.ts.map +1 -0
- package/lib/TablePanel.js +325 -0
- package/lib/TablePanel.js.map +1 -0
- package/lib/TableSettingsEditor.d.ts +4 -0
- package/lib/TableSettingsEditor.d.ts.map +1 -0
- package/lib/TableSettingsEditor.js +108 -0
- package/lib/TableSettingsEditor.js.map +1 -0
- package/lib/TableTransformsEditor.d.ts +4 -0
- package/lib/TableTransformsEditor.d.ts.map +1 -0
- package/lib/TableTransformsEditor.js +28 -0
- package/lib/TableTransformsEditor.js.map +1 -0
- package/lib/bootstrap.d.ts +2 -0
- package/lib/bootstrap.d.ts.map +1 -0
- package/lib/bootstrap.js +19 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/cjs/CellsEditor/CellEditor.js +385 -0
- package/lib/cjs/CellsEditor/CellsEditor.js +136 -0
- package/lib/cjs/CellsEditor/index.js +31 -0
- package/lib/cjs/ColumnsEditor/ColumnEditor.js +221 -0
- package/lib/cjs/ColumnsEditor/ColumnEditorContainer.js +152 -0
- package/lib/cjs/ColumnsEditor/ColumnsEditor.js +108 -0
- package/lib/cjs/ColumnsEditor/index.js +32 -0
- package/lib/cjs/EmbeddedPanel.js +52 -0
- package/lib/cjs/Table.js +54 -0
- package/lib/cjs/TableCellsEditor.js +36 -0
- package/lib/cjs/TableColumnsEditor.js +36 -0
- package/lib/cjs/TablePanel.js +341 -0
- package/lib/cjs/TableSettingsEditor.js +116 -0
- package/lib/cjs/TableTransformsEditor.js +36 -0
- package/lib/cjs/bootstrap.js +26 -0
- package/lib/cjs/env.d.js +14 -0
- package/lib/cjs/getPluginModule.js +27 -0
- package/lib/cjs/index-federation.js +55 -0
- package/lib/cjs/index.js +34 -0
- package/lib/cjs/model.js +4 -0
- package/lib/cjs/setup-tests.js +19 -0
- package/lib/cjs/table-model.js +27 -0
- package/lib/cjs/test/mock-query-results.js +417 -0
- package/lib/env.d.js +15 -0
- package/lib/env.d.js.map +1 -0
- package/lib/getPluginModule.d.ts +6 -0
- package/lib/getPluginModule.d.ts.map +1 -0
- package/lib/getPluginModule.js +16 -0
- package/lib/getPluginModule.js.map +1 -0
- package/lib/index-federation.d.ts +1 -0
- package/lib/index-federation.d.ts.map +1 -0
- package/lib/index-federation.js +15 -0
- package/lib/index-federation.js.map +1 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +13 -0
- package/lib/index.js.map +1 -0
- package/lib/model.d.ts +6 -0
- package/lib/model.d.ts.map +1 -0
- package/lib/model.js +3 -0
- package/lib/model.js.map +1 -0
- package/lib/setup-tests.d.ts +2 -0
- package/lib/setup-tests.d.ts.map +1 -0
- package/lib/setup-tests.js +17 -0
- package/lib/setup-tests.js.map +1 -0
- package/lib/table-model.d.ts +92 -0
- package/lib/table-model.d.ts.map +1 -0
- package/lib/table-model.js +21 -0
- package/lib/table-model.js.map +1 -0
- package/lib/test/mock-query-results.d.ts +136 -0
- package/lib/test/mock-query-results.d.ts.map +1 -0
- package/lib/test/mock-query-results.js +389 -0
- package/lib/test/mock-query-results.js.map +1 -0
- package/mf-manifest.json +491 -0
- package/mf-stats.json +554 -0
- package/package.json +60 -0
|
@@ -0,0 +1,372 @@
|
|
|
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 { IconButton, MenuItem, Stack, TextField, Tooltip, Typography, Grid2 as Grid } from '@mui/material';
|
|
15
|
+
import DeleteIcon from 'mdi-material-ui/DeleteOutline';
|
|
16
|
+
import { OptionsColorPicker } from '@perses-dev/components';
|
|
17
|
+
import PlusIcon from 'mdi-material-ui/Plus';
|
|
18
|
+
function ConditionEditor({ condition, onChange, ...props }) {
|
|
19
|
+
if (condition.kind === 'Value') {
|
|
20
|
+
return /*#__PURE__*/ _jsx(Stack, {
|
|
21
|
+
gap: 1,
|
|
22
|
+
direction: "row",
|
|
23
|
+
...props,
|
|
24
|
+
children: /*#__PURE__*/ _jsx(TextField, {
|
|
25
|
+
label: "Value",
|
|
26
|
+
placeholder: "Exact value",
|
|
27
|
+
value: condition.spec?.value ?? '',
|
|
28
|
+
onChange: (e)=>onChange({
|
|
29
|
+
...condition,
|
|
30
|
+
spec: {
|
|
31
|
+
value: e.target.value
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
fullWidth: true
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
} else if (condition.kind === 'Range') {
|
|
38
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
39
|
+
gap: 1,
|
|
40
|
+
direction: "row",
|
|
41
|
+
...props,
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
44
|
+
label: "From",
|
|
45
|
+
placeholder: "Start of range",
|
|
46
|
+
value: condition.spec?.min ?? '',
|
|
47
|
+
onChange: (e)=>onChange({
|
|
48
|
+
...condition,
|
|
49
|
+
spec: {
|
|
50
|
+
...condition.spec,
|
|
51
|
+
min: +e.target.value
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
fullWidth: true
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
57
|
+
label: "To",
|
|
58
|
+
placeholder: "End of range (inclusive)",
|
|
59
|
+
value: condition.spec?.max ?? '',
|
|
60
|
+
onChange: (e)=>onChange({
|
|
61
|
+
...condition,
|
|
62
|
+
spec: {
|
|
63
|
+
...condition.spec,
|
|
64
|
+
max: +e.target.value
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
fullWidth: true
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
} else if (condition.kind === 'Regex') {
|
|
72
|
+
return /*#__PURE__*/ _jsx(Stack, {
|
|
73
|
+
gap: 1,
|
|
74
|
+
direction: "row",
|
|
75
|
+
...props,
|
|
76
|
+
children: /*#__PURE__*/ _jsx(TextField, {
|
|
77
|
+
label: "Regular Expression",
|
|
78
|
+
placeholder: "JavaScript regular expression",
|
|
79
|
+
value: condition.spec?.expr ?? '',
|
|
80
|
+
onChange: (e)=>onChange({
|
|
81
|
+
...condition,
|
|
82
|
+
spec: {
|
|
83
|
+
expr: e.target.value
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
fullWidth: true
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
} else if (condition.kind === 'Misc') {
|
|
90
|
+
return /*#__PURE__*/ _jsx(Stack, {
|
|
91
|
+
gap: 1,
|
|
92
|
+
direction: "row",
|
|
93
|
+
...props,
|
|
94
|
+
children: /*#__PURE__*/ _jsxs(TextField, {
|
|
95
|
+
select: true,
|
|
96
|
+
label: "Value",
|
|
97
|
+
value: condition.spec?.value ?? '',
|
|
98
|
+
onChange: (e)=>onChange({
|
|
99
|
+
...condition,
|
|
100
|
+
spec: {
|
|
101
|
+
value: e.target.value
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
fullWidth: true,
|
|
105
|
+
children: [
|
|
106
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
107
|
+
value: "empty",
|
|
108
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
109
|
+
children: [
|
|
110
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
111
|
+
children: "Empty"
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
114
|
+
variant: "caption",
|
|
115
|
+
children: "Matches empty string"
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
})
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
121
|
+
value: "null",
|
|
122
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
123
|
+
children: [
|
|
124
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
125
|
+
children: "Null"
|
|
126
|
+
}),
|
|
127
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
128
|
+
variant: "caption",
|
|
129
|
+
children: "Matches null or undefined"
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
})
|
|
133
|
+
}),
|
|
134
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
135
|
+
value: "NaN",
|
|
136
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
137
|
+
children: [
|
|
138
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
139
|
+
children: "NaN"
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
142
|
+
variant: "caption",
|
|
143
|
+
children: "Matches Not a Number value"
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
149
|
+
value: "true",
|
|
150
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
151
|
+
children: [
|
|
152
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
153
|
+
children: "True"
|
|
154
|
+
}),
|
|
155
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
156
|
+
variant: "caption",
|
|
157
|
+
children: "Matches true boolean"
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
}),
|
|
162
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
163
|
+
value: "false",
|
|
164
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
165
|
+
children: [
|
|
166
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
167
|
+
children: "False"
|
|
168
|
+
}),
|
|
169
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
170
|
+
variant: "caption",
|
|
171
|
+
children: "Matches false boolean"
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
export function CellEditor({ cell, onChange, onDelete, ...props }) {
|
|
183
|
+
return /*#__PURE__*/ _jsxs(Grid, {
|
|
184
|
+
container: true,
|
|
185
|
+
spacing: 2,
|
|
186
|
+
...props,
|
|
187
|
+
children: [
|
|
188
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
189
|
+
size: {
|
|
190
|
+
xs: 5
|
|
191
|
+
},
|
|
192
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
193
|
+
direction: "row",
|
|
194
|
+
gap: 1,
|
|
195
|
+
width: "100%",
|
|
196
|
+
children: [
|
|
197
|
+
/*#__PURE__*/ _jsxs(TextField, {
|
|
198
|
+
select: true,
|
|
199
|
+
label: "Type",
|
|
200
|
+
value: cell.condition.kind,
|
|
201
|
+
onChange: (e)=>onChange({
|
|
202
|
+
...cell,
|
|
203
|
+
condition: {
|
|
204
|
+
kind: e.target.value
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
required: true,
|
|
208
|
+
sx: {
|
|
209
|
+
width: '120px'
|
|
210
|
+
},
|
|
211
|
+
children: [
|
|
212
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
213
|
+
value: "Value",
|
|
214
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
215
|
+
children: [
|
|
216
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
217
|
+
children: "Value"
|
|
218
|
+
}),
|
|
219
|
+
cell.condition.kind !== 'Value' && /*#__PURE__*/ _jsx(Typography, {
|
|
220
|
+
variant: "caption",
|
|
221
|
+
children: "Matches an exact text value"
|
|
222
|
+
})
|
|
223
|
+
]
|
|
224
|
+
})
|
|
225
|
+
}),
|
|
226
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
227
|
+
value: "Range",
|
|
228
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
229
|
+
children: [
|
|
230
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
231
|
+
children: "Range"
|
|
232
|
+
}),
|
|
233
|
+
cell.condition.kind !== 'Range' && /*#__PURE__*/ _jsx(Typography, {
|
|
234
|
+
variant: "caption",
|
|
235
|
+
children: "Matches against a numerical range"
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
})
|
|
239
|
+
}),
|
|
240
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
241
|
+
value: "Regex",
|
|
242
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
243
|
+
children: [
|
|
244
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
245
|
+
children: "Regex"
|
|
246
|
+
}),
|
|
247
|
+
cell.condition.kind !== 'Regex' && /*#__PURE__*/ _jsx(Typography, {
|
|
248
|
+
variant: "caption",
|
|
249
|
+
children: "Matches against a regular expression"
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
})
|
|
253
|
+
}),
|
|
254
|
+
/*#__PURE__*/ _jsx(MenuItem, {
|
|
255
|
+
value: "Misc",
|
|
256
|
+
children: /*#__PURE__*/ _jsxs(Stack, {
|
|
257
|
+
children: [
|
|
258
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
259
|
+
children: "Misc"
|
|
260
|
+
}),
|
|
261
|
+
cell.condition.kind !== 'Misc' && /*#__PURE__*/ _jsx(Typography, {
|
|
262
|
+
variant: "caption",
|
|
263
|
+
children: "Matches against empty, null and NaN values"
|
|
264
|
+
})
|
|
265
|
+
]
|
|
266
|
+
})
|
|
267
|
+
})
|
|
268
|
+
]
|
|
269
|
+
}),
|
|
270
|
+
/*#__PURE__*/ _jsx(ConditionEditor, {
|
|
271
|
+
width: "100%",
|
|
272
|
+
condition: cell.condition,
|
|
273
|
+
onChange: (updatedCondition)=>onChange({
|
|
274
|
+
...cell,
|
|
275
|
+
condition: updatedCondition
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
})
|
|
280
|
+
}),
|
|
281
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
282
|
+
size: {
|
|
283
|
+
xs: 4
|
|
284
|
+
},
|
|
285
|
+
children: /*#__PURE__*/ _jsx(TextField, {
|
|
286
|
+
label: "Display text",
|
|
287
|
+
value: cell.text,
|
|
288
|
+
onChange: (e)=>onChange({
|
|
289
|
+
...cell,
|
|
290
|
+
text: e.target.value
|
|
291
|
+
}),
|
|
292
|
+
fullWidth: true
|
|
293
|
+
})
|
|
294
|
+
}),
|
|
295
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
296
|
+
size: {
|
|
297
|
+
xs: 1
|
|
298
|
+
},
|
|
299
|
+
children: /*#__PURE__*/ _jsx(Stack, {
|
|
300
|
+
direction: "row",
|
|
301
|
+
justifyContent: "center",
|
|
302
|
+
gap: 1,
|
|
303
|
+
children: cell.textColor ? /*#__PURE__*/ _jsx(OptionsColorPicker, {
|
|
304
|
+
label: "Text Color",
|
|
305
|
+
color: cell.textColor ?? '#000',
|
|
306
|
+
onColorChange: (color)=>onChange({
|
|
307
|
+
...cell,
|
|
308
|
+
textColor: color
|
|
309
|
+
}),
|
|
310
|
+
onClear: ()=>onChange({
|
|
311
|
+
...cell,
|
|
312
|
+
textColor: undefined
|
|
313
|
+
})
|
|
314
|
+
}) : /*#__PURE__*/ _jsx(IconButton, {
|
|
315
|
+
onClick: ()=>onChange({
|
|
316
|
+
...cell,
|
|
317
|
+
textColor: '#000'
|
|
318
|
+
}),
|
|
319
|
+
children: /*#__PURE__*/ _jsx(PlusIcon, {})
|
|
320
|
+
})
|
|
321
|
+
})
|
|
322
|
+
}),
|
|
323
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
324
|
+
size: {
|
|
325
|
+
xs: 1
|
|
326
|
+
},
|
|
327
|
+
children: /*#__PURE__*/ _jsx(Stack, {
|
|
328
|
+
direction: "row",
|
|
329
|
+
justifyContent: "center",
|
|
330
|
+
children: cell.backgroundColor ? /*#__PURE__*/ _jsx(OptionsColorPicker, {
|
|
331
|
+
label: "Background Color",
|
|
332
|
+
color: cell.backgroundColor ?? '#fff',
|
|
333
|
+
onColorChange: (color)=>onChange({
|
|
334
|
+
...cell,
|
|
335
|
+
backgroundColor: color
|
|
336
|
+
}),
|
|
337
|
+
onClear: ()=>onChange({
|
|
338
|
+
...cell,
|
|
339
|
+
backgroundColor: undefined
|
|
340
|
+
})
|
|
341
|
+
}) : /*#__PURE__*/ _jsx(IconButton, {
|
|
342
|
+
onClick: ()=>onChange({
|
|
343
|
+
...cell,
|
|
344
|
+
backgroundColor: '#000'
|
|
345
|
+
}),
|
|
346
|
+
children: /*#__PURE__*/ _jsx(PlusIcon, {})
|
|
347
|
+
})
|
|
348
|
+
})
|
|
349
|
+
}),
|
|
350
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
351
|
+
size: {
|
|
352
|
+
xs: 1
|
|
353
|
+
},
|
|
354
|
+
textAlign: "end",
|
|
355
|
+
children: /*#__PURE__*/ _jsx(Tooltip, {
|
|
356
|
+
title: "Remove cell settings",
|
|
357
|
+
placement: "top",
|
|
358
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
359
|
+
size: "small",
|
|
360
|
+
sx: {
|
|
361
|
+
marginLeft: 'auto'
|
|
362
|
+
},
|
|
363
|
+
onClick: onDelete,
|
|
364
|
+
children: /*#__PURE__*/ _jsx(DeleteIcon, {})
|
|
365
|
+
}, "delete-cell-button")
|
|
366
|
+
})
|
|
367
|
+
})
|
|
368
|
+
]
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
//# sourceMappingURL=CellEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/CellsEditor/CellEditor.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 {\n Grid2Props as GridProps,\n IconButton,\n MenuItem,\n Stack,\n StackProps,\n TextField,\n Tooltip,\n Typography,\n Grid2 as Grid,\n} from '@mui/material';\nimport DeleteIcon from 'mdi-material-ui/DeleteOutline';\nimport { OptionsColorPicker } from '@perses-dev/components';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport { ReactElement } from 'react';\nimport { CellSettings, Condition } from '../table-model';\n\ninterface ConditionEditorProps extends Omit<StackProps, 'onChange'> {\n condition: Condition;\n onChange: (condition: Condition) => void;\n}\n\nfunction ConditionEditor({ condition, onChange, ...props }: ConditionEditorProps): ReactElement | null {\n if (condition.kind === 'Value') {\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"Value\"\n placeholder=\"Exact value\"\n value={condition.spec?.value ?? ''}\n onChange={(e) => onChange({ ...condition, spec: { value: e.target.value } } as Condition)}\n fullWidth\n />\n </Stack>\n );\n } else if (condition.kind === 'Range') {\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"From\"\n placeholder=\"Start of range\"\n value={condition.spec?.min ?? ''}\n onChange={(e) => onChange({ ...condition, spec: { ...condition.spec, min: +e.target.value } } as Condition)}\n fullWidth\n />\n <TextField\n label=\"To\"\n placeholder=\"End of range (inclusive)\"\n value={condition.spec?.max ?? ''}\n onChange={(e) => onChange({ ...condition, spec: { ...condition.spec, max: +e.target.value } } as Condition)}\n fullWidth\n />\n </Stack>\n );\n } else if (condition.kind === 'Regex') {\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n label=\"Regular Expression\"\n placeholder=\"JavaScript regular expression\"\n value={condition.spec?.expr ?? ''}\n onChange={(e) => onChange({ ...condition, spec: { expr: e.target.value } } as Condition)}\n fullWidth\n />\n </Stack>\n );\n } else if (condition.kind === 'Misc') {\n return (\n <Stack gap={1} direction=\"row\" {...props}>\n <TextField\n select\n label=\"Value\"\n value={condition.spec?.value ?? ''}\n onChange={(e) => onChange({ ...condition, spec: { value: e.target.value } } as Condition)}\n fullWidth\n >\n <MenuItem value=\"empty\">\n <Stack>\n <Typography>Empty</Typography>\n <Typography variant=\"caption\">Matches empty string</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"null\">\n <Stack>\n <Typography>Null</Typography>\n <Typography variant=\"caption\">Matches null or undefined</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"NaN\">\n <Stack>\n <Typography>NaN</Typography>\n <Typography variant=\"caption\">Matches Not a Number value</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"true\">\n <Stack>\n <Typography>True</Typography>\n <Typography variant=\"caption\">Matches true boolean</Typography>\n </Stack>\n </MenuItem>\n <MenuItem value=\"false\">\n <Stack>\n <Typography>False</Typography>\n <Typography variant=\"caption\">Matches false boolean</Typography>\n </Stack>\n </MenuItem>\n </TextField>\n </Stack>\n );\n }\n return null;\n}\n\nexport interface CellEditorProps extends Omit<GridProps, 'onChange'> {\n cell: CellSettings;\n onChange: (cell: CellSettings) => void;\n onDelete: () => void;\n}\n\nexport function CellEditor({ cell, onChange, onDelete, ...props }: CellEditorProps): ReactElement {\n return (\n <Grid container spacing={2} {...props}>\n <Grid size={{ xs: 5 }}>\n <Stack direction=\"row\" gap={1} width=\"100%\">\n <TextField\n select\n label=\"Type\"\n value={cell.condition.kind}\n onChange={(e) => onChange({ ...cell, condition: { kind: e.target.value } } as CellSettings)}\n required\n sx={{ width: '120px' }}\n >\n <MenuItem value=\"Value\">\n <Stack>\n <Typography>Value</Typography>\n {cell.condition.kind !== 'Value' && (\n <Typography variant=\"caption\">Matches an exact text value</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Range\">\n <Stack>\n <Typography>Range</Typography>\n {cell.condition.kind !== 'Range' && (\n <Typography variant=\"caption\">Matches against a numerical range</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Regex\">\n <Stack>\n <Typography>Regex</Typography>\n {cell.condition.kind !== 'Regex' && (\n <Typography variant=\"caption\">Matches against a regular expression</Typography>\n )}\n </Stack>\n </MenuItem>\n <MenuItem value=\"Misc\">\n <Stack>\n <Typography>Misc</Typography>\n {cell.condition.kind !== 'Misc' && (\n <Typography variant=\"caption\">Matches against empty, null and NaN values</Typography>\n )}\n </Stack>\n </MenuItem>\n </TextField>\n <ConditionEditor\n width=\"100%\"\n condition={cell.condition}\n onChange={(updatedCondition) => onChange({ ...cell, condition: updatedCondition })}\n />\n </Stack>\n </Grid>\n <Grid size={{ xs: 4 }}>\n <TextField\n label=\"Display text\"\n value={cell.text}\n onChange={(e) => onChange({ ...cell, text: e.target.value })}\n fullWidth\n />\n </Grid>\n <Grid size={{ xs: 1 }}>\n <Stack direction=\"row\" justifyContent=\"center\" gap={1}>\n {cell.textColor ? (\n <OptionsColorPicker\n label=\"Text Color\"\n color={cell.textColor ?? '#000'}\n onColorChange={(color) => onChange({ ...cell, textColor: color } as CellSettings)}\n onClear={() => onChange({ ...cell, textColor: undefined } as CellSettings)}\n />\n ) : (\n <IconButton onClick={() => onChange({ ...cell, textColor: '#000' })}>\n <PlusIcon />\n </IconButton>\n )}\n </Stack>\n </Grid>\n <Grid size={{ xs: 1 }}>\n <Stack direction=\"row\" justifyContent=\"center\">\n {cell.backgroundColor ? (\n <OptionsColorPicker\n label=\"Background Color\"\n color={cell.backgroundColor ?? '#fff'}\n onColorChange={(color) => onChange({ ...cell, backgroundColor: color } as CellSettings)}\n onClear={() => onChange({ ...cell, backgroundColor: undefined } as CellSettings)}\n />\n ) : (\n <IconButton onClick={() => onChange({ ...cell, backgroundColor: '#000' })}>\n <PlusIcon />\n </IconButton>\n )}\n </Stack>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"end\">\n <Tooltip title=\"Remove cell settings\" placement=\"top\">\n <IconButton size=\"small\" sx={{ marginLeft: 'auto' }} onClick={onDelete} key=\"delete-cell-button\">\n <DeleteIcon />\n </IconButton>\n </Tooltip>\n </Grid>\n </Grid>\n );\n}\n"],"names":["IconButton","MenuItem","Stack","TextField","Tooltip","Typography","Grid2","Grid","DeleteIcon","OptionsColorPicker","PlusIcon","ConditionEditor","condition","onChange","props","kind","gap","direction","label","placeholder","value","spec","e","target","fullWidth","min","max","expr","select","variant","CellEditor","cell","onDelete","container","spacing","size","xs","width","required","sx","updatedCondition","text","justifyContent","textColor","color","onColorChange","onClear","undefined","onClick","backgroundColor","textAlign","title","placement","marginLeft"],"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,SAEEA,UAAU,EACVC,QAAQ,EACRC,KAAK,EAELC,SAAS,EACTC,OAAO,EACPC,UAAU,EACVC,SAASC,IAAI,QACR,gBAAgB;AACvB,OAAOC,gBAAgB,gCAAgC;AACvD,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,OAAOC,cAAc,uBAAuB;AAS5C,SAASC,gBAAgB,EAAEC,SAAS,EAAEC,QAAQ,EAAE,GAAGC,OAA6B;IAC9E,IAAIF,UAAUG,IAAI,KAAK,SAAS;QAC9B,qBACE,KAACb;YAAMc,KAAK;YAAGC,WAAU;YAAO,GAAGH,KAAK;sBACtC,cAAA,KAACX;gBACCe,OAAM;gBACNC,aAAY;gBACZC,OAAOR,UAAUS,IAAI,EAAED,SAAS;gBAChCP,UAAU,CAACS,IAAMT,SAAS;wBAAE,GAAGD,SAAS;wBAAES,MAAM;4BAAED,OAAOE,EAAEC,MAAM,CAACH,KAAK;wBAAC;oBAAE;gBAC1EI,SAAS;;;IAIjB,OAAO,IAAIZ,UAAUG,IAAI,KAAK,SAAS;QACrC,qBACE,MAACb;YAAMc,KAAK;YAAGC,WAAU;YAAO,GAAGH,KAAK;;8BACtC,KAACX;oBACCe,OAAM;oBACNC,aAAY;oBACZC,OAAOR,UAAUS,IAAI,EAAEI,OAAO;oBAC9BZ,UAAU,CAACS,IAAMT,SAAS;4BAAE,GAAGD,SA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AAM;oBAAEC,IAAI;gBAAE;0BAClB,cAAA,KAAClC;oBAAMe,WAAU;oBAAMyB,gBAAe;8BACnCX,KAAKkB,eAAe,iBACnB,KAACxC;wBACCS,OAAM;wBACN0B,OAAOb,KAAKkB,eAAe,IAAI;wBAC/BJ,eAAe,CAACD,QAAU/B,SAAS;gCAAE,GAAGkB,IAAI;gCAAEkB,iBAAiBL;4BAAM;wBACrEE,SAAS,IAAMjC,SAAS;gCAAE,GAAGkB,IAAI;gCAAEkB,iBAAiBF;4BAAU;uCAGhE,KAAC/C;wBAAWgD,SAAS,IAAMnC,SAAS;gCAAE,GAAGkB,IAAI;gCAAEkB,iBAAiB;4BAAO;kCACrE,cAAA,KAACvC;;;;0BAKT,KAACH;gBAAK4B,MAAM;oBAAEC,IAAI;gBAAE;gBAAGc,WAAU;0BAC/B,cAAA,KAAC9C;oBAAQ+C,OAAM;oBAAuBC,WAAU;8BAC9C,cAAA,KAACpD;wBAAWmC,MAAK;wBAAQI,IAAI;4BAAEc,YAAY;wBAAO;wBAAGL,SAAShB;kCAC5D,cAAA,KAACxB;uBADyE;;;;;AAOtF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { CellSettings } from '../table-model';
|
|
3
|
+
export interface CellsEditorProps {
|
|
4
|
+
cellSettings: CellSettings[];
|
|
5
|
+
onChange: (cellOptions: CellSettings[]) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function CellsEditor({ cellSettings, onChange }: CellsEditorProps): ReactElement;
|
|
8
|
+
//# sourceMappingURL=CellsEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CellsEditor.d.ts","sourceRoot":"","sources":["../../../src/CellsEditor/CellsEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,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,CAoDtF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
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, Divider, Stack, Typography, Grid2 as Grid } from '@mui/material';
|
|
15
|
+
import AddIcon from 'mdi-material-ui/Plus';
|
|
16
|
+
import { CellEditor } from './CellEditor';
|
|
17
|
+
export function CellsEditor({ cellSettings, onChange }) {
|
|
18
|
+
function handleCellChange(index, cell) {
|
|
19
|
+
const updatedCells = [
|
|
20
|
+
...cellSettings
|
|
21
|
+
];
|
|
22
|
+
updatedCells[index] = cell;
|
|
23
|
+
onChange(updatedCells);
|
|
24
|
+
}
|
|
25
|
+
function handleAddCellEditor() {
|
|
26
|
+
const updatedCells = [
|
|
27
|
+
...cellSettings
|
|
28
|
+
];
|
|
29
|
+
updatedCells.push({
|
|
30
|
+
condition: {
|
|
31
|
+
kind: 'Value',
|
|
32
|
+
spec: {
|
|
33
|
+
value: ''
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
onChange(updatedCells);
|
|
38
|
+
}
|
|
39
|
+
function handleCellDelete(index) {
|
|
40
|
+
const updatedCells = [
|
|
41
|
+
...cellSettings
|
|
42
|
+
];
|
|
43
|
+
updatedCells.splice(index, 1);
|
|
44
|
+
onChange(updatedCells);
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/ _jsxs(Stack, {
|
|
47
|
+
spacing: 1,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ _jsxs(Grid, {
|
|
50
|
+
container: true,
|
|
51
|
+
spacing: 2,
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
54
|
+
size: {
|
|
55
|
+
xs: 5
|
|
56
|
+
},
|
|
57
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
58
|
+
variant: "subtitle1",
|
|
59
|
+
children: "Condition"
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
63
|
+
size: {
|
|
64
|
+
xs: 4
|
|
65
|
+
},
|
|
66
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
67
|
+
variant: "subtitle1",
|
|
68
|
+
children: "Display Text"
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
72
|
+
size: {
|
|
73
|
+
xs: 1
|
|
74
|
+
},
|
|
75
|
+
textAlign: "center",
|
|
76
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
77
|
+
variant: "subtitle1",
|
|
78
|
+
children: "Color"
|
|
79
|
+
})
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
82
|
+
size: {
|
|
83
|
+
xs: 1
|
|
84
|
+
},
|
|
85
|
+
textAlign: "center",
|
|
86
|
+
children: /*#__PURE__*/ _jsx(Typography, {
|
|
87
|
+
variant: "subtitle1",
|
|
88
|
+
children: "Background"
|
|
89
|
+
})
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ _jsx(Grid, {
|
|
92
|
+
size: {
|
|
93
|
+
xs: 1
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
99
|
+
gap: 1.5,
|
|
100
|
+
divider: /*#__PURE__*/ _jsx(Divider, {
|
|
101
|
+
flexItem: true,
|
|
102
|
+
orientation: "horizontal"
|
|
103
|
+
}),
|
|
104
|
+
children: cellSettings.map((cell, i)=>/*#__PURE__*/ _jsx(CellEditor, {
|
|
105
|
+
cell: cell,
|
|
106
|
+
onChange: (updatedCell)=>handleCellChange(i, updatedCell),
|
|
107
|
+
onDelete: ()=>handleCellDelete(i)
|
|
108
|
+
}, i))
|
|
109
|
+
}),
|
|
110
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
111
|
+
variant: "contained",
|
|
112
|
+
startIcon: /*#__PURE__*/ _jsx(AddIcon, {}),
|
|
113
|
+
sx: {
|
|
114
|
+
marginTop: 1
|
|
115
|
+
},
|
|
116
|
+
onClick: handleAddCellEditor,
|
|
117
|
+
children: "Add Cell Settings"
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=CellsEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/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 { Button, Divider, Stack, Typography, Grid2 as Grid } from '@mui/material';\n\nimport AddIcon from 'mdi-material-ui/Plus';\nimport { ReactElement } from 'react';\nimport { CellSettings } from '../table-model';\nimport { CellEditor } from './CellEditor';\n\nexport interface CellsEditorProps {\n cellSettings: CellSettings[];\n onChange: (cellOptions: CellSettings[]) => void;\n}\n\nexport function CellsEditor({ cellSettings, onChange }: CellsEditorProps): ReactElement {\n function handleCellChange(index: number, cell: CellSettings): void {\n const updatedCells = [...cellSettings];\n updatedCells[index] = cell;\n onChange(updatedCells);\n }\n\n function handleAddCellEditor(): void {\n const updatedCells = [...cellSettings];\n updatedCells.push({ condition: { kind: 'Value', spec: { value: '' } } });\n onChange(updatedCells);\n }\n\n function handleCellDelete(index: number): void {\n const updatedCells = [...cellSettings];\n updatedCells.splice(index, 1);\n onChange(updatedCells);\n }\n\n return (\n <Stack spacing={1}>\n <Grid container spacing={2}>\n <Grid size={{ xs: 5 }}>\n <Typography variant=\"subtitle1\">Condition</Typography>\n </Grid>\n <Grid size={{ xs: 4 }}>\n <Typography variant=\"subtitle1\">Display Text</Typography>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"center\">\n <Typography variant=\"subtitle1\">Color</Typography>\n </Grid>\n <Grid size={{ xs: 1 }} textAlign=\"center\">\n <Typography variant=\"subtitle1\">Background</Typography>\n </Grid>\n <Grid size={{ xs: 1 }}></Grid>\n </Grid>\n <Stack gap={1.5} divider={<Divider flexItem orientation=\"horizontal\" />}>\n {cellSettings.map((cell, i) => (\n <CellEditor\n key={i}\n cell={cell}\n onChange={(updatedCell: CellSettings) => handleCellChange(i, updatedCell)}\n onDelete={() => handleCellDelete(i)}\n />\n ))}\n </Stack>\n\n <Button variant=\"contained\" startIcon={<AddIcon />} sx={{ marginTop: 1 }} onClick={handleAddCellEditor}>\n Add Cell Settings\n </Button>\n </Stack>\n );\n}\n"],"names":["Button","Divider","Stack","Typography","Grid2","Grid","AddIcon","CellEditor","CellsEditor","cellSettings","onChange","handleCellChange","index","cell","updatedCells","handleAddCellEditor","push","condition","kind","spec","value","handleCellDelete","splice","spacing","container","size","xs","variant","textAlign","gap","divider","flexItem","orientation","map","i","updatedCell","onDelete","startIcon","sx","marginTop","onClick"],"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,SAASA,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,UAAU,EAAEC,SAASC,IAAI,QAAQ,gBAAgB;AAElF,OAAOC,aAAa,uBAAuB;AAG3C,SAASC,UAAU,QAAQ,eAAe;AAO1C,OAAO,SAASC,YAAY,EAAEC,YAAY,EAAEC,QAAQ,EAAoB;IACtE,SAASC,iBAAiBC,KAAa,EAAEC,IAAkB;QACzD,MAAMC,eAAe;eAAIL;SAAa;QACtCK,YAAY,CAACF,MAAM,GAAGC;QACtBH,SAASI;IACX;IAEA,SAASC;QACP,MAAMD,eAAe;eAAIL;SAAa;QACtCK,aAAaE,IAAI,CAAC;YAAEC,WAAW;gBAAEC,MAAM;gBAASC,MAAM;oBAAEC,OAAO;gBAAG;YAAE;QAAE;QACtEV,SAASI;IACX;IAEA,SAASO,iBAAiBT,KAAa;QACrC,MAAME,eAAe;eAAIL;SAAa;QACtCK,aAAaQ,MAAM,CAACV,OAAO;QAC3BF,SAASI;IACX;IAEA,qBACE,MAACZ;QAAMqB,SAAS;;0BACd,MAAClB;gBAAKmB,SAAS;gBAACD,SAAS;;kCACvB,KAAClB;wBAAKoB,MAAM;4BAAEC,IAAI;wBAAE;kCAClB,cAAA,KAACvB;4BAAWwB,SAAQ;sCAAY;;;kCAElC,KAACtB;wBAAKoB,MAAM;4BAAEC,IAAI;wBAAE;kCAClB,cAAA,KAACvB;4BAAWwB,SAAQ;sCAAY;;;kCAElC,KAACtB;wBAAKoB,MAAM;4BAAEC,IAAI;wBAAE;wBAAGE,WAAU;kCAC/B,cAAA,KAACzB;4BAAWwB,SAAQ;sCAAY;;;kCAElC,KAACtB;wBAAKoB,MAAM;4BAAEC,IAAI;wBAAE;wBAAGE,WAAU;kCAC/B,cAAA,KAACzB;4BAAWwB,SAAQ;sCAAY;;;kCAElC,KAACtB;wBAAKoB,MAAM;4BAAEC,IAAI;wBAAE;;;;0BAEtB,KAACxB;gBAAM2B,KAAK;gBAAKC,uBAAS,KAAC7B;oBAAQ8B,QAAQ;oBAACC,aAAY;;0BACrDvB,aAAawB,GAAG,CAAC,CAACpB,MAAMqB,kBACvB,KAAC3B;wBAECM,MAAMA;wBACNH,UAAU,CAACyB,cAA8BxB,iBAAiBuB,GAAGC;wBAC7DC,UAAU,IAAMf,iBAAiBa;uBAH5BA;;0BAQX,KAAClC;gBAAO2B,SAAQ;gBAAYU,yBAAW,KAAC/B;gBAAYgC,IAAI;oBAAEC,WAAW;gBAAE;gBAAGC,SAASzB;0BAAqB;;;;AAK9G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/CellsEditor/index.ts"],"names":[],"mappings":"AAaA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export * from './CellEditor';
|
|
14
|
+
export * from './CellsEditor';
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/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 './CellEditor';\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,eAAe;AAC7B,cAAc,gBAAgB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StackProps } from '@mui/material';
|
|
2
|
+
import { ReactElement } from 'react';
|
|
3
|
+
import { ColumnSettings } from '../table-model';
|
|
4
|
+
type OmittedMuiProps = 'children' | 'value' | 'onChange';
|
|
5
|
+
export interface ColumnEditorProps extends Omit<StackProps, OmittedMuiProps> {
|
|
6
|
+
column: ColumnSettings;
|
|
7
|
+
onChange: (column: ColumnSettings) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function ColumnEditor({ column, onChange, ...others }: ColumnEditorProps): ReactElement;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ColumnEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColumnEditor.d.ts","sourceRoot":"","sources":["../../../src/ColumnsEditor/ColumnEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAuB,UAAU,EAAqB,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAY/C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAOhD,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,CAkK7F"}
|