@perses-dev/plugin-system 0.0.0-snapshot-embed-import-errors-8906900 → 0.0.0-snapshot-test-internal-dep-dd238ac
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/dist/cjs/components/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/cjs/components/CalculationSelector/index.js +1 -1
- package/dist/cjs/components/DatasourceSelect.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +5 -48
- package/dist/cjs/components/OptionsEditorTabs/TabPanel.js +1 -1
- package/dist/cjs/components/OptionsEditorTabs/index.js +1 -1
- package/dist/cjs/components/PluginEditor/PluginEditor.js +1 -1
- package/dist/cjs/components/PluginEditor/index.js +1 -1
- package/dist/cjs/components/PluginEditor/plugin-editor-api.js +1 -1
- package/dist/cjs/components/PluginKindSelect.js +1 -1
- package/dist/cjs/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/cjs/components/PluginRegistry/index.js +1 -1
- package/dist/cjs/components/PluginRegistry/plugin-indexes.js +1 -1
- package/dist/cjs/components/PluginSpecEditor.js +39 -5
- package/dist/cjs/components/TimeSeriesQueryEditor.js +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/model/calculations.js +11 -13
- package/dist/cjs/model/datasource.js +1 -1
- package/dist/cjs/model/index.js +3 -3
- package/dist/cjs/model/panels.js +7 -1
- package/dist/cjs/model/plugin-base.js +1 -1
- package/dist/cjs/model/plugin-loading.js +1 -1
- package/dist/cjs/model/plugins.js +1 -1
- package/dist/cjs/model/time-series-queries.js +1 -1
- package/dist/cjs/model/variables.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/index.js +1 -1
- package/dist/cjs/runtime/TimeRangeProvider/query-params.js +1 -1
- package/dist/cjs/runtime/datasources.js +1 -1
- package/dist/cjs/runtime/index.js +1 -1
- package/dist/cjs/runtime/plugin-registry.js +1 -1
- package/dist/cjs/runtime/template-variables.js +1 -1
- package/dist/cjs/runtime/time-series-queries.js +1 -1
- package/dist/cjs/test/index.js +1 -1
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/test/setup-tests.js +1 -1
- package/dist/cjs/test/test-plugins/bert/index.js +33 -20
- package/dist/cjs/test/test-plugins/ernie/index.js +1 -1
- package/dist/cjs/test/test-plugins/index.js +1 -1
- package/dist/cjs/test-utils/index.js +1 -1
- package/dist/cjs/test-utils/mock-plugin-registry.js +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js +1 -1
- package/dist/components/CalculationSelector/CalculationSelector.js.map +1 -1
- package/dist/components/CalculationSelector/index.js +1 -1
- package/dist/components/CalculationSelector/index.js.map +1 -1
- package/dist/components/DatasourceSelect.js +1 -1
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts +3 -24
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.d.ts.map +1 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +5 -48
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/OptionsEditorTabs/TabPanel.js +1 -1
- package/dist/components/OptionsEditorTabs/TabPanel.js.map +1 -1
- package/dist/components/OptionsEditorTabs/index.js +1 -1
- package/dist/components/OptionsEditorTabs/index.js.map +1 -1
- package/dist/components/PluginEditor/PluginEditor.js +1 -1
- package/dist/components/PluginEditor/PluginEditor.js.map +1 -1
- package/dist/components/PluginEditor/index.js +1 -1
- package/dist/components/PluginEditor/index.js.map +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js +1 -1
- package/dist/components/PluginEditor/plugin-editor-api.js.map +1 -1
- package/dist/components/PluginKindSelect.js +1 -1
- package/dist/components/PluginKindSelect.js.map +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js +1 -1
- package/dist/components/PluginRegistry/PluginRegistry.js.map +1 -1
- package/dist/components/PluginRegistry/index.js +1 -1
- package/dist/components/PluginRegistry/index.js.map +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js +1 -1
- package/dist/components/PluginRegistry/plugin-indexes.js.map +1 -1
- package/dist/components/PluginSpecEditor.d.ts.map +1 -1
- package/dist/components/PluginSpecEditor.js +40 -6
- package/dist/components/PluginSpecEditor.js.map +1 -1
- package/dist/components/TimeSeriesQueryEditor.js +1 -1
- package/dist/components/TimeSeriesQueryEditor.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model/calculations.d.ts +1 -1
- package/dist/model/calculations.d.ts.map +1 -1
- package/dist/model/calculations.js +9 -5
- package/dist/model/calculations.js.map +1 -1
- package/dist/model/datasource.js +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/index.d.ts +2 -2
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +3 -3
- package/dist/model/index.js.map +1 -1
- package/dist/model/panels.d.ts +14 -2
- package/dist/model/panels.d.ts.map +1 -1
- package/dist/model/panels.js +2 -2
- package/dist/model/panels.js.map +1 -1
- package/dist/model/plugin-base.d.ts +1 -1
- package/dist/model/plugin-base.d.ts.map +1 -1
- package/dist/model/plugin-base.js +1 -1
- package/dist/model/plugin-base.js.map +1 -1
- package/dist/model/plugin-loading.js +1 -1
- package/dist/model/plugin-loading.js.map +1 -1
- package/dist/model/plugins.js +1 -1
- package/dist/model/plugins.js.map +1 -1
- package/dist/model/time-series-queries.d.ts +3 -4
- package/dist/model/time-series-queries.d.ts.map +1 -1
- package/dist/model/time-series-queries.js +1 -1
- package/dist/model/time-series-queries.js.map +1 -1
- package/dist/model/variables.js +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js +1 -1
- package/dist/runtime/TimeRangeProvider/TimeRangeProvider.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/index.js +1 -1
- package/dist/runtime/TimeRangeProvider/index.js.map +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js +1 -1
- package/dist/runtime/TimeRangeProvider/query-params.js.map +1 -1
- package/dist/runtime/datasources.js +1 -1
- package/dist/runtime/datasources.js.map +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/plugin-registry.js +1 -1
- package/dist/runtime/plugin-registry.js.map +1 -1
- package/dist/runtime/template-variables.js +1 -1
- package/dist/runtime/template-variables.js.map +1 -1
- package/dist/runtime/time-series-queries.js +1 -1
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.js +1 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/test/test-plugins/bert/index.d.ts.map +1 -1
- package/dist/test/test-plugins/bert/index.js +33 -20
- package/dist/test/test-plugins/bert/index.js.map +1 -1
- package/dist/test/test-plugins/ernie/index.js +1 -1
- package/dist/test/test-plugins/ernie/index.js.map +1 -1
- package/dist/test/test-plugins/index.js +1 -1
- package/dist/test/test-plugins/index.js.map +1 -1
- package/dist/test-utils/index.js +1 -1
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/mock-plugin-registry.js +1 -1
- package/dist/test-utils/mock-plugin-registry.js.map +1 -1
- package/package.json +5 -4
- package/dist/cjs/components/CalculationSelector/CalculationSelector.test.js +0 -65
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.test.js +0 -167
- package/dist/cjs/components/PluginEditor/PluginEditor.test.js +0 -150
- package/dist/cjs/components/PluginKindSelect.test.js +0 -86
- package/dist/cjs/components/PluginRegistry/PluginRegistry.test.js +0 -144
- package/dist/cjs/components/PluginSpecEditor.test.js +0 -70
- package/dist/components/CalculationSelector/CalculationSelector.test.d.ts +0 -2
- package/dist/components/CalculationSelector/CalculationSelector.test.d.ts.map +0 -1
- package/dist/components/CalculationSelector/CalculationSelector.test.js +0 -58
- package/dist/components/CalculationSelector/CalculationSelector.test.js.map +0 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts +0 -2
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.d.ts.map +0 -1
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js +0 -160
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.test.js.map +0 -1
- package/dist/components/PluginEditor/PluginEditor.test.d.ts +0 -2
- package/dist/components/PluginEditor/PluginEditor.test.d.ts.map +0 -1
- package/dist/components/PluginEditor/PluginEditor.test.js +0 -143
- package/dist/components/PluginEditor/PluginEditor.test.js.map +0 -1
- package/dist/components/PluginKindSelect.test.d.ts +0 -2
- package/dist/components/PluginKindSelect.test.d.ts.map +0 -1
- package/dist/components/PluginKindSelect.test.js +0 -79
- package/dist/components/PluginKindSelect.test.js.map +0 -1
- package/dist/components/PluginRegistry/PluginRegistry.test.d.ts +0 -2
- package/dist/components/PluginRegistry/PluginRegistry.test.d.ts.map +0 -1
- package/dist/components/PluginRegistry/PluginRegistry.test.js +0 -137
- package/dist/components/PluginRegistry/PluginRegistry.test.js.map +0 -1
- package/dist/components/PluginSpecEditor.test.d.ts +0 -2
- package/dist/components/PluginSpecEditor.test.d.ts.map +0 -1
- package/dist/components/PluginSpecEditor.test.js +0 -63
- package/dist/components/PluginSpecEditor.test.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 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
|
|
@@ -22,54 +22,11 @@ const _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
22
|
const _material = require("@mui/material");
|
|
23
23
|
const _react = require("react");
|
|
24
24
|
const _tabPanel = require("./TabPanel");
|
|
25
|
-
// Configuration of the order and labeling for tabs across plugins to enforce a
|
|
26
|
-
// consistent UX.
|
|
27
|
-
const TAB_CONFIG = [
|
|
28
|
-
{
|
|
29
|
-
id: 'query',
|
|
30
|
-
label: 'Query'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: 'settings',
|
|
34
|
-
label: 'Settings'
|
|
35
|
-
},
|
|
36
|
-
// Custom tabs go between the visual common tabs and the raw JSON editor.
|
|
37
|
-
'other',
|
|
38
|
-
{
|
|
39
|
-
id: 'json',
|
|
40
|
-
label: 'JSON'
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
25
|
const OptionsEditorTabs = ({ tabs })=>{
|
|
44
26
|
const [activeTab, setActiveTab] = (0, _react.useState)(0);
|
|
45
27
|
const handleChange = (_, newValue)=>{
|
|
46
28
|
setActiveTab(newValue);
|
|
47
29
|
};
|
|
48
|
-
// Normalize the common tabs that are managed via constants in this file
|
|
49
|
-
// and custom tabs that bring their own config into a consistent shape for
|
|
50
|
-
// rendering.
|
|
51
|
-
const normalizedTabs = TAB_CONFIG.reduce((combinedTabs, tabConfig)=>{
|
|
52
|
-
// Custom tabs
|
|
53
|
-
if (tabConfig === 'other') {
|
|
54
|
-
const otherTabs = (tabs === null || tabs === void 0 ? void 0 : tabs.other) || [];
|
|
55
|
-
return [
|
|
56
|
-
...combinedTabs,
|
|
57
|
-
...otherTabs
|
|
58
|
-
];
|
|
59
|
-
}
|
|
60
|
-
// Common tabs
|
|
61
|
-
const commonTab = tabs[tabConfig.id];
|
|
62
|
-
if (commonTab) {
|
|
63
|
-
return [
|
|
64
|
-
...combinedTabs,
|
|
65
|
-
{
|
|
66
|
-
...tabConfig,
|
|
67
|
-
...commonTab
|
|
68
|
-
}
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
return combinedTabs;
|
|
72
|
-
}, []);
|
|
73
30
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
74
31
|
children: [
|
|
75
32
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
@@ -81,21 +38,21 @@ const OptionsEditorTabs = ({ tabs })=>{
|
|
|
81
38
|
value: activeTab,
|
|
82
39
|
onChange: handleChange,
|
|
83
40
|
"aria-label": "Panel configuration tabs",
|
|
84
|
-
children:
|
|
41
|
+
children: tabs.map(({ label }, i)=>{
|
|
85
42
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Tab, {
|
|
86
43
|
label: label,
|
|
87
44
|
id: `options-editor-tab-${i}`,
|
|
88
45
|
"aria-controls": `options-editor-tabpanel-${i}`
|
|
89
|
-
},
|
|
46
|
+
}, label);
|
|
90
47
|
})
|
|
91
48
|
})
|
|
92
49
|
}),
|
|
93
|
-
|
|
50
|
+
tabs.map(({ label , content }, i)=>{
|
|
94
51
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_tabPanel.TabPanel, {
|
|
95
52
|
value: activeTab,
|
|
96
53
|
index: i,
|
|
97
54
|
children: content
|
|
98
|
-
},
|
|
55
|
+
}, label);
|
|
99
56
|
})
|
|
100
57
|
]
|
|
101
58
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 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
|
|
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "PluginSpecEditor", {
|
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _components = require("@perses-dev/components");
|
|
23
23
|
const _runtime = require("../runtime");
|
|
24
|
+
const _optionsEditorTabs = require("./OptionsEditorTabs");
|
|
24
25
|
function PluginSpecEditor(props) {
|
|
25
26
|
const { pluginType , pluginKind , ...others } = props;
|
|
26
27
|
const { data: plugin , isLoading , error } = (0, _runtime.usePlugin)(pluginType, pluginKind);
|
|
@@ -34,10 +35,43 @@ function PluginSpecEditor(props) {
|
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
36
37
|
if (plugin === undefined) {
|
|
37
|
-
throw new Error(`Missing
|
|
38
|
+
throw new Error(`Missing implementation for ${pluginType} plugin with kind '${pluginKind}'`);
|
|
39
|
+
}
|
|
40
|
+
if (pluginType === 'Panel') {
|
|
41
|
+
const { PanelQueryEditorComponent , panelOptionsEditorComponents } = plugin;
|
|
42
|
+
let tabs = [];
|
|
43
|
+
if (PanelQueryEditorComponent !== undefined) {
|
|
44
|
+
tabs.push({
|
|
45
|
+
label: 'Query',
|
|
46
|
+
content: /*#__PURE__*/ (0, _jsxRuntime.jsx)(PanelQueryEditorComponent, {
|
|
47
|
+
...others
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (panelOptionsEditorComponents !== undefined) {
|
|
52
|
+
tabs = tabs.concat(panelOptionsEditorComponents.map(({ label , content: OptionsEditorComponent })=>({
|
|
53
|
+
label,
|
|
54
|
+
content: /*#__PURE__*/ (0, _jsxRuntime.jsx)(OptionsEditorComponent, {
|
|
55
|
+
...others
|
|
56
|
+
})
|
|
57
|
+
})));
|
|
58
|
+
}
|
|
59
|
+
// always show json editor by default
|
|
60
|
+
tabs.push({
|
|
61
|
+
label: 'JSON',
|
|
62
|
+
content: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_components.JSONEditor, {
|
|
63
|
+
...others
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorTabs.OptionsEditorTabs, {
|
|
67
|
+
tabs: tabs
|
|
68
|
+
});
|
|
38
69
|
}
|
|
39
70
|
const { OptionsEditorComponent } = plugin;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
if (OptionsEditorComponent !== undefined) {
|
|
72
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(OptionsEditorComponent, {
|
|
73
|
+
...others
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
43
77
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 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
|
|
@@ -25,14 +25,7 @@ _export(exports, {
|
|
|
25
25
|
CALCULATIONS_CONFIG: ()=>CALCULATIONS_CONFIG,
|
|
26
26
|
DEFAULT_CALCULATION: ()=>DEFAULT_CALCULATION
|
|
27
27
|
});
|
|
28
|
-
const
|
|
29
|
-
const _meanBy = /*#__PURE__*/ _interopRequireDefault(require("lodash/meanBy"));
|
|
30
|
-
const _sumBy = /*#__PURE__*/ _interopRequireDefault(require("lodash/sumBy"));
|
|
31
|
-
function _interopRequireDefault(obj) {
|
|
32
|
-
return obj && obj.__esModule ? obj : {
|
|
33
|
-
default: obj
|
|
34
|
-
};
|
|
35
|
-
}
|
|
28
|
+
const _lodashEs = require("lodash-es");
|
|
36
29
|
const CalculationsMap = {
|
|
37
30
|
First: first,
|
|
38
31
|
Last: last,
|
|
@@ -68,17 +61,22 @@ function last(values) {
|
|
|
68
61
|
return tuple === undefined ? undefined : getValue(tuple);
|
|
69
62
|
}
|
|
70
63
|
function lastNumber(values) {
|
|
71
|
-
const tuple = (0,
|
|
64
|
+
const tuple = (0, _lodashEs.findLast)(values, (tuple)=>isNaN(getValue(tuple)) === false);
|
|
72
65
|
return tuple === undefined ? undefined : getValue(tuple);
|
|
73
66
|
}
|
|
74
67
|
function mean(values) {
|
|
75
68
|
if (values.length <= 0) return undefined;
|
|
76
|
-
return (0,
|
|
69
|
+
return (0, _lodashEs.meanBy)(values, getValue);
|
|
77
70
|
}
|
|
78
71
|
function sum(values) {
|
|
79
72
|
if (values.length <= 0) return undefined;
|
|
80
|
-
return (0,
|
|
73
|
+
return (0, _lodashEs.sumBy)(values, getValue);
|
|
81
74
|
}
|
|
82
75
|
function getValue(valueTuple) {
|
|
83
|
-
|
|
76
|
+
const value = valueTuple[1];
|
|
77
|
+
if (value !== null) {
|
|
78
|
+
return value;
|
|
79
|
+
}
|
|
80
|
+
// TODO: refactor utils so null can be returned and LastNotNull supported
|
|
81
|
+
return NaN;
|
|
84
82
|
}
|
package/dist/cjs/model/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 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
|
|
@@ -18,10 +18,10 @@ _exportStar(require("./calculations"), exports);
|
|
|
18
18
|
_exportStar(require("./datasource"), exports);
|
|
19
19
|
_exportStar(require("./panels"), exports);
|
|
20
20
|
_exportStar(require("./plugins"), exports);
|
|
21
|
-
_exportStar(require("./time-series-queries"), exports);
|
|
22
|
-
_exportStar(require("./variables"), exports);
|
|
23
21
|
_exportStar(require("./plugin-base"), exports);
|
|
24
22
|
_exportStar(require("./plugin-loading"), exports);
|
|
23
|
+
_exportStar(require("./time-series-queries"), exports);
|
|
24
|
+
_exportStar(require("./variables"), exports);
|
|
25
25
|
function _exportStar(from, to) {
|
|
26
26
|
Object.keys(from).forEach(function(k) {
|
|
27
27
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
package/dist/cjs/model/panels.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 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,3 +14,9 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
const _react = /*#__PURE__*/ _interopRequireDefault(require("react"));
|
|
18
|
+
function _interopRequireDefault(obj) {
|
|
19
|
+
return obj && obj.__esModule ? obj : {
|
|
20
|
+
default: obj
|
|
21
|
+
};
|
|
22
|
+
}
|
package/dist/cjs/test/index.js
CHANGED
package/dist/cjs/test/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright
|
|
1
|
+
// Copyright 2023 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
|
|
@@ -27,7 +27,7 @@ _export(exports, {
|
|
|
27
27
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
28
28
|
const BertPanel1 = {
|
|
29
29
|
PanelComponent: ()=>null,
|
|
30
|
-
|
|
30
|
+
PanelQueryEditorComponent: function BertPanel1Editor({ value , onChange }) {
|
|
31
31
|
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
|
|
32
32
|
children: [
|
|
33
33
|
/*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
|
|
@@ -52,25 +52,38 @@ const BertPanel1 = {
|
|
|
52
52
|
};
|
|
53
53
|
const BertPanel2 = {
|
|
54
54
|
PanelComponent: ()=>null,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
children:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
panelOptionsEditorComponents: [
|
|
56
|
+
{
|
|
57
|
+
label: 'Settings',
|
|
58
|
+
content: function BertPanel2Editor({ value , onChange }) {
|
|
59
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)("div", {
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("label", {
|
|
62
|
+
htmlFor: "editor-input",
|
|
63
|
+
children: "BertPanel2 editor"
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)("input", {
|
|
66
|
+
type: "text",
|
|
67
|
+
id: "editor-input",
|
|
68
|
+
value: value.option2,
|
|
69
|
+
onChange: (e)=>onChange({
|
|
70
|
+
...value,
|
|
71
|
+
option2: e.target.value
|
|
72
|
+
})
|
|
69
73
|
})
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: 'Custom Tab',
|
|
80
|
+
content: function Editor() {
|
|
81
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
82
|
+
children: "custom content"
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
],
|
|
74
87
|
createInitialOptions: ()=>({
|
|
75
88
|
option2: ''
|
|
76
89
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CalculationSelector/CalculationSelector.tsx"],"sourcesContent":["// Copyright 2023 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 { TextField, Autocomplete } from '@mui/material';\nimport { OptionsEditorControl } from '@perses-dev/components';\nimport { CALCULATIONS_CONFIG, CalculationConfig, CalculationType } from '../../model/calculations';\n\ntype AutocompleteCalculationOption = CalculationConfig & { id: CalculationType };\nconst CALC_OPTIONS: AutocompleteCalculationOption[] = Object.entries(CALCULATIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as CalculationType,\n ...config,\n };\n});\n\nexport interface CalculationSelectorProps {\n value: CalculationType;\n onChange: (unit: CalculationType) => void;\n}\n\nexport function CalculationSelector({ value, onChange }: CalculationSelectorProps) {\n const handleCalculationChange = (_: unknown, newValue: AutocompleteCalculationOption) => {\n onChange(newValue.id);\n };\n\n const calcConfig = CALCULATIONS_CONFIG[value];\n\n return (\n <OptionsEditorControl\n label=\"Calculation\"\n control={\n <Autocomplete\n value={{\n ...calcConfig,\n id: value,\n }}\n options={CALC_OPTIONS}\n isOptionEqualToValue={(option, value) => option.id === value.id}\n renderInput={(params) => <TextField {...params} />}\n onChange={handleCalculationChange}\n disableClearable\n ></Autocomplete>\n }\n />\n );\n}\n"],"names":["TextField","Autocomplete","OptionsEditorControl","CALCULATIONS_CONFIG","CALC_OPTIONS","Object","entries","map","id","config","CalculationSelector","value","onChange","handleCalculationChange","_","newValue","calcConfig","label","control","options","isOptionEqualToValue","option","renderInput","params","disableClearable"],"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;AAAA,SAASA,SAAS,EAAEC,YAAY,QAAQ,eAAe,CAAC;AACxD,SAASC,oBAAoB,QAAQ,wBAAwB,CAAC;AAC9D,SAASC,mBAAmB,QAA4C,0BAA0B,CAAC;AAGnG,MAAMC,YAAY,GAAoCC,MAAM,CAACC,OAAO,CAACH,mBAAmB,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,EAAE,EAAEC,MAAM,CAAC,GAAK;IAC9G,OAAO;QACLD,EAAE,EAAEA,EAAE;QACN,GAAGC,MAAM;KACV,CAAC;AACJ,CAAC,CAAC,AAAC;AAOH,OAAO,SAASC,mBAAmB,CAAC,EAAEC,KAAK,CAAA,EAAEC,QAAQ,CAAA,EAA4B,EAAE;IACjF,MAAMC,uBAAuB,GAAG,CAACC,CAAU,EAAEC,QAAuC,GAAK;QACvFH,QAAQ,CAACG,QAAQ,CAACP,EAAE,CAAC,CAAC;IACxB,CAAC,AAAC;IAEF,MAAMQ,UAAU,GAAGb,mBAAmB,CAACQ,KAAK,CAAC,AAAC;IAE9C,qBACE,KAACT,oBAAoB;QACnBe,KAAK,EAAC,aAAa;QACnBC,OAAO,gBACL,KAACjB,YAAY;YACXU,KAAK,EAAE;gBACL,GAAGK,UAAU;gBACbR,EAAE,EAAEG,KAAK;aACV;YACDQ,OAAO,EAAEf,YAAY;YACrBgB,oBAAoB,EAAE,CAACC,MAAM,EAAEV,KAAK,GAAKU,MAAM,CAACb,EAAE,KAAKG,KAAK,CAACH,EAAE;YAC/Dc,WAAW,EAAE,CAACC,MAAM,iBAAK,KAACvB,SAAS;oBAAE,GAAGuB,MAAM;kBAAI;YAClDX,QAAQ,EAAEC,uBAAuB;YACjCW,gBAAgB;UACF;MAElB,CACF;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CalculationSelector/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CalculationSelector/index.ts"],"sourcesContent":["// Copyright 2023 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 './CalculationSelector';\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,uBAAuB,CAAC"}
|