@perses-dev/timeseries-chart-plugin 0.10.0 → 0.10.2
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/__mf/js/TimeSeriesChart.2e93229a.js +5 -0
- package/__mf/js/async/109.f05e61af.js +73 -0
- package/__mf/js/async/{964.719c530c.js → 110.8b9c7f4b.js} +2 -2
- package/__mf/js/async/186.b17dcce5.js +1 -0
- package/__mf/js/async/{547.bb4f1e58.js → 547.a80ef962.js} +2 -2
- package/__mf/js/async/964.e89cbd3b.js +110 -0
- package/__mf/js/async/{580.5f4b0dbd.js → 971.6fcf317e.js} +3 -3
- package/__mf/js/async/__federation_expose_TimeSeriesChart.f017c9e5.js +3 -0
- package/__mf/js/main.25080a30.js +5 -0
- package/lib/GeneralSettingsEditor.d.ts +4 -0
- package/lib/GeneralSettingsEditor.d.ts.map +1 -0
- package/lib/{TimeSeriesChartOptionsEditorSettings.js → GeneralSettingsEditor.js} +3 -14
- package/lib/GeneralSettingsEditor.js.map +1 -0
- package/lib/QuerySettingsEditor.d.ts +3 -17
- package/lib/QuerySettingsEditor.d.ts.map +1 -1
- package/lib/QuerySettingsEditor.js +370 -88
- package/lib/QuerySettingsEditor.js.map +1 -1
- package/lib/TimeSeriesChart.d.ts.map +1 -1
- package/lib/TimeSeriesChart.js +8 -3
- package/lib/TimeSeriesChart.js.map +1 -1
- package/lib/TimeSeriesChartPanel.js +1 -1
- package/lib/TimeSeriesChartPanel.js.map +1 -1
- package/lib/VisualOptionsEditor.d.ts.map +1 -1
- package/lib/VisualOptionsEditor.js +84 -64
- package/lib/VisualOptionsEditor.js.map +1 -1
- package/lib/cjs/{TimeSeriesChartOptionsEditorSettings.js → GeneralSettingsEditor.js} +4 -15
- package/lib/cjs/QuerySettingsEditor.js +410 -95
- package/lib/cjs/TimeSeriesChart.js +8 -3
- package/lib/cjs/TimeSeriesChartPanel.js +1 -1
- package/lib/cjs/VisualOptionsEditor.js +82 -62
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/time-series-chart-model.js +37 -0
- package/lib/cjs/utils/data-transform.js +7 -54
- package/lib/cjs/utils/palette-gen.js +2 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/time-series-chart-model.d.ts +32 -2
- package/lib/time-series-chart-model.d.ts.map +1 -1
- package/lib/time-series-chart-model.js +25 -0
- package/lib/time-series-chart-model.js.map +1 -1
- package/lib/utils/data-transform.d.ts +6 -7
- package/lib/utils/data-transform.d.ts.map +1 -1
- package/lib/utils/data-transform.js +8 -54
- package/lib/utils/data-transform.js.map +1 -1
- package/lib/utils/palette-gen.js +2 -2
- package/lib/utils/palette-gen.js.map +1 -1
- package/mf-manifest.json +14 -14
- package/mf-stats.json +14 -14
- package/package.json +5 -5
- package/__mf/js/TimeSeriesChart.d3742b3b.js +0 -5
- package/__mf/js/async/109.bf4f02fe.js +0 -73
- package/__mf/js/async/133.c48c8cc8.js +0 -110
- package/__mf/js/async/686.0cd9a75c.js +0 -1
- package/__mf/js/async/__federation_expose_TimeSeriesChart.f20a0aca.js +0 -3
- package/__mf/js/main.2c598209.js +0 -5
- package/lib/TimeSeriesChartOptionsEditorSettings.d.ts +0 -4
- package/lib/TimeSeriesChartOptionsEditorSettings.d.ts.map +0 -1
- package/lib/TimeSeriesChartOptionsEditorSettings.js.map +0 -1
- /package/__mf/js/async/{109.bf4f02fe.js.LICENSE.txt → 109.f05e61af.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{964.719c530c.js.LICENSE.txt → 110.8b9c7f4b.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{547.bb4f1e58.js.LICENSE.txt → 547.a80ef962.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{133.c48c8cc8.js.LICENSE.txt → 964.e89cbd3b.js.LICENSE.txt} +0 -0
|
@@ -14,37 +14,78 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
get: all[name]
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
_export(exports, {
|
|
24
|
-
QuerySettingsEditor: function() {
|
|
17
|
+
Object.defineProperty(exports, "QuerySettingsEditor", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
25
20
|
return QuerySettingsEditor;
|
|
26
|
-
},
|
|
27
|
-
QuerySettingsInput: function() {
|
|
28
|
-
return QuerySettingsInput;
|
|
29
21
|
}
|
|
30
22
|
});
|
|
31
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
32
24
|
const _material = require("@mui/material");
|
|
33
25
|
const _components = require("@perses-dev/components");
|
|
34
|
-
const _react = require("react");
|
|
26
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
35
27
|
const _DeleteOutline = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/DeleteOutline"));
|
|
36
28
|
const _Plus = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Plus"));
|
|
29
|
+
const _Close = /*#__PURE__*/ _interop_require_default(require("mdi-material-ui/Close"));
|
|
37
30
|
const _immer = require("immer");
|
|
38
31
|
const _pluginsystem = require("@perses-dev/plugin-system");
|
|
32
|
+
const _timeserieschartmodel = require("./time-series-chart-model");
|
|
39
33
|
function _interop_require_default(obj) {
|
|
40
34
|
return obj && obj.__esModule ? obj : {
|
|
41
35
|
default: obj
|
|
42
36
|
};
|
|
43
37
|
}
|
|
44
|
-
|
|
38
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
39
|
+
if (typeof WeakMap !== "function") return null;
|
|
40
|
+
var cacheBabelInterop = new WeakMap();
|
|
41
|
+
var cacheNodeInterop = new WeakMap();
|
|
42
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
43
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
44
|
+
})(nodeInterop);
|
|
45
|
+
}
|
|
46
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
47
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
48
|
+
return obj;
|
|
49
|
+
}
|
|
50
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
51
|
+
return {
|
|
52
|
+
default: obj
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
56
|
+
if (cache && cache.has(obj)) {
|
|
57
|
+
return cache.get(obj);
|
|
58
|
+
}
|
|
59
|
+
var newObj = {
|
|
60
|
+
__proto__: null
|
|
61
|
+
};
|
|
62
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
63
|
+
for(var key in obj){
|
|
64
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
65
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
66
|
+
if (desc && (desc.get || desc.set)) {
|
|
67
|
+
Object.defineProperty(newObj, key, desc);
|
|
68
|
+
} else {
|
|
69
|
+
newObj[key] = obj[key];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
newObj.default = obj;
|
|
74
|
+
if (cache) {
|
|
75
|
+
cache.set(obj, newObj);
|
|
76
|
+
}
|
|
77
|
+
return newObj;
|
|
78
|
+
}
|
|
45
79
|
const DEFAULT_COLOR_VALUE = '#555';
|
|
46
80
|
const NO_INDEX_AVAILABLE = -1; // invalid array index value used to represent the fact that no query index is available
|
|
47
|
-
function QuerySettingsEditor(
|
|
81
|
+
function QuerySettingsEditor(props) {
|
|
82
|
+
const { onChange, value } = props;
|
|
83
|
+
const querySettingsList = value.querySettings;
|
|
84
|
+
const handleQuerySettingsChange = (newQuerySettings)=>{
|
|
85
|
+
onChange((0, _immer.produce)(value, (draft)=>{
|
|
86
|
+
draft.querySettings = newQuerySettings;
|
|
87
|
+
}));
|
|
88
|
+
};
|
|
48
89
|
// Every time a new query settings input is added, we want to focus the recently added input
|
|
49
90
|
const recentlyAddedInputRef = (0, _react.useRef)(null);
|
|
50
91
|
const focusRef = (0, _react.useRef)(false);
|
|
@@ -57,7 +98,7 @@ function QuerySettingsEditor({ querySettingsList, onChange }) {
|
|
|
57
98
|
]);
|
|
58
99
|
const handleQueryIndexChange = (e, i)=>{
|
|
59
100
|
if (querySettingsList !== undefined) {
|
|
60
|
-
|
|
101
|
+
handleQuerySettingsChange((0, _immer.produce)(querySettingsList, (draft)=>{
|
|
61
102
|
const querySettings = draft?.[i];
|
|
62
103
|
if (querySettings) {
|
|
63
104
|
querySettings.queryIndex = parseInt(e.target.value);
|
|
@@ -67,11 +108,17 @@ function QuerySettingsEditor({ querySettingsList, onChange }) {
|
|
|
67
108
|
};
|
|
68
109
|
const handleColorModeChange = (e, i)=>{
|
|
69
110
|
if (querySettingsList !== undefined) {
|
|
70
|
-
|
|
111
|
+
handleQuerySettingsChange((0, _immer.produce)(querySettingsList, (draft)=>{
|
|
71
112
|
if (draft !== undefined) {
|
|
72
113
|
const querySettings = draft[i];
|
|
73
114
|
if (querySettings) {
|
|
74
|
-
|
|
115
|
+
const newColorMode = e.target.value;
|
|
116
|
+
if (!newColorMode) {
|
|
117
|
+
querySettings.colorMode = undefined;
|
|
118
|
+
querySettings.colorValue = undefined;
|
|
119
|
+
} else {
|
|
120
|
+
querySettings.colorMode = newColorMode;
|
|
121
|
+
}
|
|
75
122
|
}
|
|
76
123
|
}
|
|
77
124
|
}));
|
|
@@ -79,7 +126,7 @@ function QuerySettingsEditor({ querySettingsList, onChange }) {
|
|
|
79
126
|
};
|
|
80
127
|
const handleColorValueChange = (colorValue, i)=>{
|
|
81
128
|
if (querySettingsList !== undefined) {
|
|
82
|
-
|
|
129
|
+
handleQuerySettingsChange((0, _immer.produce)(querySettingsList, (draft)=>{
|
|
83
130
|
if (draft !== undefined) {
|
|
84
131
|
const querySettings = draft[i];
|
|
85
132
|
if (querySettings) {
|
|
@@ -89,14 +136,82 @@ function QuerySettingsEditor({ querySettingsList, onChange }) {
|
|
|
89
136
|
}));
|
|
90
137
|
}
|
|
91
138
|
};
|
|
139
|
+
const handleLineStyleChange = (lineStyle, i)=>{
|
|
140
|
+
if (querySettingsList !== undefined) {
|
|
141
|
+
handleQuerySettingsChange((0, _immer.produce)(querySettingsList, (draft)=>{
|
|
142
|
+
if (draft !== undefined) {
|
|
143
|
+
const querySettings = draft[i];
|
|
144
|
+
if (querySettings) {
|
|
145
|
+
querySettings.lineStyle = lineStyle;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const handleAreaOpacityChange = (_, sliderValue, i)=>{
|
|
152
|
+
const newValue = Array.isArray(sliderValue) ? sliderValue[0] : sliderValue;
|
|
153
|
+
if (querySettingsList !== undefined) {
|
|
154
|
+
handleQuerySettingsChange((0, _immer.produce)(querySettingsList, (draft)=>{
|
|
155
|
+
if (draft !== undefined) {
|
|
156
|
+
const querySettings = draft[i];
|
|
157
|
+
if (querySettings) {
|
|
158
|
+
querySettings.areaOpacity = newValue;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}));
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
// Helper function to update query settings at a specific index
|
|
165
|
+
const updateQuerySettings = (i, updater)=>{
|
|
166
|
+
if (querySettingsList !== undefined) {
|
|
167
|
+
handleQuerySettingsChange((0, _immer.produce)(querySettingsList, (draft)=>{
|
|
168
|
+
const qs = draft[i];
|
|
169
|
+
if (qs) {
|
|
170
|
+
updater(qs);
|
|
171
|
+
}
|
|
172
|
+
}));
|
|
173
|
+
}
|
|
174
|
+
};
|
|
92
175
|
const deleteQuerySettingsInput = (i)=>{
|
|
93
176
|
if (querySettingsList !== undefined) {
|
|
94
177
|
const updatedQuerySettingsList = (0, _immer.produce)(querySettingsList, (draft)=>{
|
|
95
178
|
draft.splice(i, 1);
|
|
96
179
|
});
|
|
97
|
-
|
|
180
|
+
handleQuerySettingsChange(updatedQuerySettingsList);
|
|
98
181
|
}
|
|
99
182
|
};
|
|
183
|
+
const addColor = (i)=>{
|
|
184
|
+
updateQuerySettings(i, (qs)=>{
|
|
185
|
+
qs.colorMode = 'fixed-single';
|
|
186
|
+
qs.colorValue = DEFAULT_COLOR_VALUE;
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
const removeColor = (i)=>{
|
|
190
|
+
updateQuerySettings(i, (qs)=>{
|
|
191
|
+
qs.colorMode = undefined;
|
|
192
|
+
qs.colorValue = undefined;
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
const addLineStyle = (i)=>{
|
|
196
|
+
updateQuerySettings(i, (qs)=>{
|
|
197
|
+
qs.lineStyle = 'solid';
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const removeLineStyle = (i)=>{
|
|
201
|
+
updateQuerySettings(i, (qs)=>{
|
|
202
|
+
qs.lineStyle = undefined;
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
const addAreaOpacity = (i)=>{
|
|
206
|
+
updateQuerySettings(i, (qs)=>{
|
|
207
|
+
qs.areaOpacity = _timeserieschartmodel.DEFAULT_AREA_OPACITY;
|
|
208
|
+
});
|
|
209
|
+
};
|
|
210
|
+
const removeAreaOpacity = (i)=>{
|
|
211
|
+
updateQuerySettings(i, (qs)=>{
|
|
212
|
+
qs.areaOpacity = undefined;
|
|
213
|
+
});
|
|
214
|
+
};
|
|
100
215
|
const queryCount = (0, _pluginsystem.useQueryCountContext)();
|
|
101
216
|
// Compute the list of query indexes for which query settings are not already defined.
|
|
102
217
|
// This is to avoid already-booked indexes to still be selectable in the dropdown(s)
|
|
@@ -116,106 +231,306 @@ function QuerySettingsEditor({ querySettingsList, onChange }) {
|
|
|
116
231
|
availableQueryIndexes
|
|
117
232
|
]);
|
|
118
233
|
const defaultQuerySettings = {
|
|
119
|
-
queryIndex: firstAvailableQueryIndex
|
|
120
|
-
colorMode: DEFAULT_COLOR_MODE,
|
|
121
|
-
colorValue: DEFAULT_COLOR_VALUE
|
|
234
|
+
queryIndex: firstAvailableQueryIndex
|
|
122
235
|
};
|
|
123
236
|
const addQuerySettingsInput = ()=>{
|
|
124
237
|
focusRef.current = true;
|
|
125
238
|
if (querySettingsList === undefined) {
|
|
126
|
-
|
|
239
|
+
handleQuerySettingsChange([
|
|
127
240
|
defaultQuerySettings
|
|
128
241
|
]);
|
|
129
242
|
} else {
|
|
130
|
-
|
|
243
|
+
handleQuerySettingsChange((0, _immer.produce)(querySettingsList, (draft)=>{
|
|
131
244
|
draft.push(defaultQuerySettings);
|
|
132
245
|
}));
|
|
133
246
|
}
|
|
134
247
|
};
|
|
135
|
-
return /*#__PURE__*/ (0, _jsxruntime.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
248
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
249
|
+
children: [
|
|
250
|
+
queryCount === 0 ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
251
|
+
mb: 2,
|
|
252
|
+
fontStyle: "italic",
|
|
253
|
+
children: "No query defined"
|
|
254
|
+
}) : querySettingsList?.length && querySettingsList.map((querySettings, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(QuerySettingsInput, {
|
|
255
|
+
inputRef: i === querySettingsList.length - 1 ? recentlyAddedInputRef : undefined,
|
|
256
|
+
querySettings: querySettings,
|
|
257
|
+
availableQueryIndexes: availableQueryIndexes,
|
|
258
|
+
onQueryIndexChange: (e)=>{
|
|
259
|
+
handleQueryIndexChange(e, i);
|
|
260
|
+
},
|
|
261
|
+
onColorModeChange: (e)=>handleColorModeChange(e, i),
|
|
262
|
+
onColorValueChange: (color)=>handleColorValueChange(color, i),
|
|
263
|
+
onLineStyleChange: (lineStyle)=>handleLineStyleChange(lineStyle, i),
|
|
264
|
+
onAreaOpacityChange: (event, value)=>handleAreaOpacityChange(event, value, i),
|
|
265
|
+
onDelete: ()=>{
|
|
266
|
+
deleteQuerySettingsInput(i);
|
|
267
|
+
},
|
|
268
|
+
onAddColor: ()=>addColor(i),
|
|
269
|
+
onRemoveColor: ()=>removeColor(i),
|
|
270
|
+
onAddLineStyle: ()=>addLineStyle(i),
|
|
271
|
+
onRemoveLineStyle: ()=>removeLineStyle(i),
|
|
272
|
+
onAddAreaOpacity: ()=>addAreaOpacity(i),
|
|
273
|
+
onRemoveAreaOpacity: ()=>removeAreaOpacity(i)
|
|
274
|
+
}, i)),
|
|
275
|
+
queryCount > 0 && firstAvailableQueryIndex !== NO_INDEX_AVAILABLE && /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Button, {
|
|
276
|
+
variant: "contained",
|
|
277
|
+
startIcon: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {}),
|
|
278
|
+
sx: {
|
|
279
|
+
marginTop: 1
|
|
280
|
+
},
|
|
142
281
|
onClick: addQuerySettingsInput,
|
|
143
|
-
children:
|
|
282
|
+
children: "Add Query Settings"
|
|
144
283
|
})
|
|
145
|
-
|
|
146
|
-
children: querySettingsList && querySettingsList.length > 0 ? querySettingsList.map((querySettings, i)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(QuerySettingsInput, {
|
|
147
|
-
inputRef: i === querySettingsList.length - 1 ? recentlyAddedInputRef : undefined,
|
|
148
|
-
querySettings: querySettings,
|
|
149
|
-
availableQueryIndexes: availableQueryIndexes,
|
|
150
|
-
onQueryIndexChange: (e)=>{
|
|
151
|
-
handleQueryIndexChange(e, i);
|
|
152
|
-
},
|
|
153
|
-
onColorModeChange: (e)=>handleColorModeChange(e, i),
|
|
154
|
-
onColorValueChange: (color)=>handleColorValueChange(color, i),
|
|
155
|
-
onDelete: ()=>{
|
|
156
|
-
deleteQuerySettingsInput(i);
|
|
157
|
-
}
|
|
158
|
-
}, i)) : /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
159
|
-
mb: 2,
|
|
160
|
-
fontStyle: "italic",
|
|
161
|
-
children: "No query settings defined"
|
|
162
|
-
})
|
|
284
|
+
]
|
|
163
285
|
});
|
|
164
286
|
}
|
|
165
|
-
function QuerySettingsInput({ querySettings: { queryIndex, colorMode, colorValue }, availableQueryIndexes, onQueryIndexChange, onColorModeChange, onColorValueChange, onDelete, inputRef }) {
|
|
287
|
+
function QuerySettingsInput({ querySettings: { queryIndex, colorMode, colorValue, lineStyle, areaOpacity }, availableQueryIndexes, onQueryIndexChange, onColorModeChange, onColorValueChange, onLineStyleChange, onAreaOpacityChange, onDelete, inputRef, onAddColor: onAddColor, onRemoveColor: onRemoveColor, onAddLineStyle, onRemoveLineStyle, onAddAreaOpacity, onRemoveAreaOpacity }) {
|
|
166
288
|
// current query index should also be selectable
|
|
167
289
|
const selectableQueryIndexes = availableQueryIndexes.concat(queryIndex).sort((a, b)=>a - b);
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
290
|
+
// State for dropdown menu
|
|
291
|
+
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
292
|
+
// Calculate available options
|
|
293
|
+
const availableOptions = (0, _react.useMemo)(()=>{
|
|
294
|
+
const options = [];
|
|
295
|
+
if (!colorMode) options.push({
|
|
296
|
+
key: 'color',
|
|
297
|
+
label: 'Color',
|
|
298
|
+
action: onAddColor
|
|
299
|
+
});
|
|
300
|
+
if (!lineStyle) options.push({
|
|
301
|
+
key: 'lineStyle',
|
|
302
|
+
label: 'Line Style',
|
|
303
|
+
action: onAddLineStyle
|
|
304
|
+
});
|
|
305
|
+
if (areaOpacity === undefined) options.push({
|
|
306
|
+
key: 'opacity',
|
|
307
|
+
label: 'Opacity',
|
|
308
|
+
action: onAddAreaOpacity
|
|
309
|
+
});
|
|
310
|
+
return options;
|
|
311
|
+
}, [
|
|
312
|
+
colorMode,
|
|
313
|
+
lineStyle,
|
|
314
|
+
areaOpacity,
|
|
315
|
+
onAddColor,
|
|
316
|
+
onAddLineStyle,
|
|
317
|
+
onAddAreaOpacity
|
|
318
|
+
]);
|
|
319
|
+
const handleAddMenuClick = (event)=>{
|
|
320
|
+
if (availableOptions.length === 1 && availableOptions[0]) {
|
|
321
|
+
// If only one option left, add it directly
|
|
322
|
+
availableOptions[0].action();
|
|
323
|
+
} else {
|
|
324
|
+
// Show dropdown
|
|
325
|
+
setAnchorEl(event.currentTarget);
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
const handleMenuClose = ()=>{
|
|
329
|
+
setAnchorEl(null);
|
|
330
|
+
};
|
|
331
|
+
const handleMenuItemClick = (action)=>{
|
|
332
|
+
action();
|
|
333
|
+
handleMenuClose();
|
|
334
|
+
};
|
|
335
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Stack, {
|
|
336
|
+
spacing: 2,
|
|
337
|
+
sx: {
|
|
338
|
+
borderBottom: '1px solid',
|
|
339
|
+
borderColor: 'divider',
|
|
340
|
+
borderRadius: 1,
|
|
341
|
+
p: 2
|
|
342
|
+
},
|
|
343
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
344
|
+
direction: "row",
|
|
345
|
+
alignItems: "center",
|
|
346
|
+
spacing: 1,
|
|
347
|
+
sx: {
|
|
348
|
+
flexWrap: 'wrap',
|
|
349
|
+
gap: 1
|
|
350
|
+
},
|
|
351
|
+
children: [
|
|
352
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.TextField, {
|
|
353
|
+
select: true,
|
|
354
|
+
inputRef: inputRef,
|
|
355
|
+
value: queryIndex,
|
|
356
|
+
label: "Query",
|
|
357
|
+
onChange: onQueryIndexChange,
|
|
358
|
+
sx: {
|
|
359
|
+
minWidth: '75px'
|
|
360
|
+
},
|
|
361
|
+
children: selectableQueryIndexes.map((qi)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.MenuItem, {
|
|
362
|
+
value: qi,
|
|
363
|
+
children: [
|
|
364
|
+
"#",
|
|
365
|
+
qi + 1
|
|
366
|
+
]
|
|
367
|
+
}, `query-${qi}`))
|
|
368
|
+
}),
|
|
369
|
+
colorMode && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
|
|
370
|
+
label: "Color",
|
|
371
|
+
onRemove: onRemoveColor,
|
|
372
|
+
children: [
|
|
373
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.TextField, {
|
|
374
|
+
select: true,
|
|
375
|
+
value: colorMode,
|
|
376
|
+
onChange: onColorModeChange,
|
|
377
|
+
size: "small",
|
|
378
|
+
sx: {
|
|
379
|
+
flexGrow: 1
|
|
380
|
+
},
|
|
381
|
+
children: [
|
|
382
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
383
|
+
value: "fixed-single",
|
|
384
|
+
children: "Fixed (single)"
|
|
385
|
+
}),
|
|
386
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.MenuItem, {
|
|
387
|
+
value: "fixed",
|
|
388
|
+
children: "Fixed"
|
|
389
|
+
})
|
|
390
|
+
]
|
|
391
|
+
}),
|
|
392
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsColorPicker, {
|
|
393
|
+
label: `Query n°${queryIndex + 1}`,
|
|
394
|
+
color: colorValue || DEFAULT_COLOR_VALUE,
|
|
395
|
+
onColorChange: onColorValueChange
|
|
396
|
+
})
|
|
397
|
+
]
|
|
398
|
+
}),
|
|
399
|
+
lineStyle && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
|
|
400
|
+
label: "Line Style",
|
|
401
|
+
onRemove: onRemoveLineStyle,
|
|
402
|
+
children: [
|
|
403
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButtonGroup, {
|
|
404
|
+
color: "primary",
|
|
405
|
+
exclusive: true,
|
|
406
|
+
value: lineStyle,
|
|
407
|
+
onChange: (__, newValue)=>{
|
|
408
|
+
if (newValue !== null) {
|
|
409
|
+
onLineStyleChange(newValue);
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
size: "small",
|
|
413
|
+
children: Object.entries(_timeserieschartmodel.LINE_STYLE_CONFIG).map(([styleValue, config])=>/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.ToggleButton, {
|
|
414
|
+
value: styleValue,
|
|
415
|
+
"aria-label": `${styleValue} line style`,
|
|
416
|
+
children: config.label
|
|
417
|
+
}, styleValue))
|
|
418
|
+
}),
|
|
419
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
420
|
+
sx: {
|
|
421
|
+
flexGrow: 1
|
|
422
|
+
}
|
|
423
|
+
})
|
|
424
|
+
]
|
|
425
|
+
}),
|
|
426
|
+
areaOpacity !== undefined && /*#__PURE__*/ (0, _jsxruntime.jsxs)(SettingsSection, {
|
|
427
|
+
label: "Opacity",
|
|
428
|
+
onRemove: onRemoveAreaOpacity,
|
|
429
|
+
children: [
|
|
430
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {}),
|
|
431
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Slider, {
|
|
432
|
+
value: areaOpacity,
|
|
433
|
+
valueLabelDisplay: "auto",
|
|
434
|
+
step: _timeserieschartmodel.OPACITY_CONFIG.step,
|
|
435
|
+
marks: true,
|
|
436
|
+
min: _timeserieschartmodel.OPACITY_CONFIG.min,
|
|
437
|
+
max: _timeserieschartmodel.OPACITY_CONFIG.max,
|
|
438
|
+
onChange: onAreaOpacityChange,
|
|
439
|
+
sx: {
|
|
440
|
+
flexGrow: 1
|
|
441
|
+
}
|
|
442
|
+
})
|
|
443
|
+
]
|
|
444
|
+
}),
|
|
445
|
+
availableOptions.length > 0 && /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
|
446
|
+
children: [
|
|
447
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
448
|
+
onClick: handleAddMenuClick,
|
|
449
|
+
"aria-label": "Add option",
|
|
450
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {})
|
|
451
|
+
}),
|
|
452
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Menu, {
|
|
453
|
+
anchorEl: anchorEl,
|
|
454
|
+
open: Boolean(anchorEl),
|
|
455
|
+
onClose: handleMenuClose,
|
|
456
|
+
anchorOrigin: {
|
|
457
|
+
vertical: 'bottom',
|
|
458
|
+
horizontal: 'left'
|
|
459
|
+
},
|
|
460
|
+
children: availableOptions.map((option)=>/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.MenuItem, {
|
|
461
|
+
onClick: ()=>handleMenuItemClick(option.action),
|
|
462
|
+
sx: {
|
|
463
|
+
minWidth: '120px'
|
|
464
|
+
},
|
|
465
|
+
children: [
|
|
466
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_Plus.default, {
|
|
467
|
+
sx: {
|
|
468
|
+
mr: 1,
|
|
469
|
+
fontSize: '1rem'
|
|
470
|
+
}
|
|
471
|
+
}),
|
|
472
|
+
option.label
|
|
473
|
+
]
|
|
474
|
+
}, option.key))
|
|
475
|
+
})
|
|
476
|
+
]
|
|
477
|
+
}),
|
|
478
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Box, {
|
|
479
|
+
sx: {
|
|
480
|
+
flexGrow: 1
|
|
481
|
+
}
|
|
482
|
+
}),
|
|
483
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
484
|
+
"aria-label": `delete settings for query n°${queryIndex + 1}`,
|
|
485
|
+
onClick: onDelete,
|
|
486
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {})
|
|
487
|
+
})
|
|
488
|
+
]
|
|
489
|
+
})
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
// Reusable section component
|
|
493
|
+
function SettingsSection(props) {
|
|
494
|
+
const { label, children, onRemove } = props;
|
|
495
|
+
const theme = (0, _material.useTheme)();
|
|
496
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Box, {
|
|
497
|
+
sx: {
|
|
498
|
+
position: 'relative',
|
|
499
|
+
minWidth: '250px'
|
|
500
|
+
},
|
|
174
501
|
children: [
|
|
175
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.
|
|
176
|
-
|
|
177
|
-
inputRef: inputRef,
|
|
178
|
-
value: queryIndex,
|
|
179
|
-
label: "Query",
|
|
180
|
-
onChange: onQueryIndexChange,
|
|
502
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Typography, {
|
|
503
|
+
variant: "caption",
|
|
181
504
|
sx: {
|
|
182
|
-
|
|
505
|
+
position: 'absolute',
|
|
506
|
+
top: -8,
|
|
507
|
+
left: 12,
|
|
508
|
+
backgroundColor: theme.palette.background.code,
|
|
509
|
+
px: 0.5,
|
|
510
|
+
color: 'text.secondary',
|
|
511
|
+
zIndex: 1
|
|
183
512
|
},
|
|
184
|
-
children:
|
|
185
|
-
value: queryIndex,
|
|
186
|
-
children: [
|
|
187
|
-
"#",
|
|
188
|
-
queryIndex + 1
|
|
189
|
-
]
|
|
190
|
-
}, `query-${queryIndex}`))
|
|
513
|
+
children: label
|
|
191
514
|
}),
|
|
192
|
-
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
515
|
+
/*#__PURE__*/ (0, _jsxruntime.jsxs)(_material.Stack, {
|
|
516
|
+
direction: "row",
|
|
517
|
+
alignItems: "center",
|
|
518
|
+
spacing: 1,
|
|
519
|
+
sx: {
|
|
520
|
+
border: '1px solid',
|
|
521
|
+
borderColor: 'divider',
|
|
522
|
+
borderRadius: 1,
|
|
523
|
+
p: 1
|
|
524
|
+
},
|
|
198
525
|
children: [
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
children: "Fixed"
|
|
526
|
+
children,
|
|
527
|
+
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
528
|
+
size: "small",
|
|
529
|
+
onClick: onRemove,
|
|
530
|
+
"aria-label": `Remove ${label}`,
|
|
531
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_Close.default, {})
|
|
206
532
|
})
|
|
207
533
|
]
|
|
208
|
-
}),
|
|
209
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsColorPicker, {
|
|
210
|
-
label: 'Query n°' + queryIndex,
|
|
211
|
-
color: colorValue,
|
|
212
|
-
onColorChange: onColorValueChange
|
|
213
|
-
}),
|
|
214
|
-
/*#__PURE__*/ (0, _jsxruntime.jsx)(_material.IconButton, {
|
|
215
|
-
"aria-label": `delete settings for query n°${queryIndex + 1}`,
|
|
216
|
-
size: "small",
|
|
217
|
-
onClick: onDelete,
|
|
218
|
-
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_DeleteOutline.default, {})
|
|
219
534
|
})
|
|
220
535
|
]
|
|
221
536
|
});
|
|
@@ -21,7 +21,8 @@ Object.defineProperty(exports, "TimeSeriesChart", {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _timeserieschartmodel = require("./time-series-chart-model");
|
|
24
|
-
const
|
|
24
|
+
const _GeneralSettingsEditor = require("./GeneralSettingsEditor");
|
|
25
|
+
const _QuerySettingsEditor = require("./QuerySettingsEditor");
|
|
25
26
|
const _TimeSeriesChartPanel = require("./TimeSeriesChartPanel");
|
|
26
27
|
const _TimeSeriesExportAction = require("./TimeSeriesExportAction");
|
|
27
28
|
const TimeSeriesChart = {
|
|
@@ -31,8 +32,12 @@ const TimeSeriesChart = {
|
|
|
31
32
|
],
|
|
32
33
|
panelOptionsEditorComponents: [
|
|
33
34
|
{
|
|
34
|
-
label: 'Settings',
|
|
35
|
-
content:
|
|
35
|
+
label: 'General Settings',
|
|
36
|
+
content: _GeneralSettingsEditor.TimeSeriesChartGeneralSettings
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Query Settings',
|
|
40
|
+
content: _QuerySettingsEditor.QuerySettingsEditor
|
|
36
41
|
}
|
|
37
42
|
],
|
|
38
43
|
createInitialOptions: _timeserieschartmodel.createInitialTimeSeriesChartOptions,
|
|
@@ -148,7 +148,7 @@ function TimeSeriesChartPanel(props) {
|
|
|
148
148
|
const datasetIndex = timeChartData.length;
|
|
149
149
|
// Each series is stored as a separate dataset source.
|
|
150
150
|
// https://apache.github.io/echarts-handbook/en/concepts/dataset/#how-to-reference-several-datasets
|
|
151
|
-
timeSeriesMapping.push((0, _datatransform.getTimeSeries)(seriesId, datasetIndex, formattedSeriesName, visual, timeScale, seriesColor));
|
|
151
|
+
timeSeriesMapping.push((0, _datatransform.getTimeSeries)(seriesId, datasetIndex, formattedSeriesName, visual, timeScale, seriesColor, querySettings));
|
|
152
152
|
timeChartData.push({
|
|
153
153
|
name: formattedSeriesName,
|
|
154
154
|
values: (0, _core.getTimeSeriesValues)(timeSeries, timeScale)
|