@perses-dev/plugin-system 0.38.0 → 0.39.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/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +74 -0
- package/dist/cjs/components/OptionsEditorRadios/index.js +28 -0
- package/dist/cjs/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +3 -3
- package/dist/cjs/components/OptionsEditorTabPanel/index.js +28 -0
- package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/runtime/DataQueriesProvider/DataQueriesProvider.js +40 -28
- package/dist/cjs/runtime/DataQueriesProvider/model.js +57 -0
- package/dist/cjs/runtime/template-variables.js +62 -0
- package/dist/cjs/test/index.js +1 -0
- package/dist/cjs/test/mock-data.js +55 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +16 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +68 -0
- package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
- package/dist/components/OptionsEditorRadios/index.d.ts +2 -0
- package/dist/components/OptionsEditorRadios/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorRadios/index.js +15 -0
- package/dist/components/OptionsEditorRadios/index.js.map +1 -0
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +9 -0
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -0
- package/dist/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +2 -2
- package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
- package/dist/components/OptionsEditorTabPanel/index.d.ts +2 -0
- package/dist/components/OptionsEditorTabPanel/index.d.ts.map +1 -0
- package/dist/components/OptionsEditorTabPanel/index.js +15 -0
- package/dist/components/OptionsEditorTabPanel/index.js.map +1 -0
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
- package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts +5 -5
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js +39 -27
- package/dist/runtime/DataQueriesProvider/DataQueriesProvider.js.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.d.ts +15 -11
- package/dist/runtime/DataQueriesProvider/model.d.ts.map +1 -1
- package/dist/runtime/DataQueriesProvider/model.js +47 -1
- package/dist/runtime/DataQueriesProvider/model.js.map +1 -1
- package/dist/runtime/template-variables.d.ts +61 -2
- package/dist/runtime/template-variables.d.ts.map +1 -1
- package/dist/runtime/template-variables.js +63 -0
- package/dist/runtime/template-variables.js.map +1 -1
- package/dist/test/index.d.ts +1 -0
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +1 -0
- package/dist/test/index.js.map +1 -1
- package/dist/test/mock-data.d.ts +3 -0
- package/dist/test/mock-data.d.ts.map +1 -0
- package/dist/test/mock-data.js +49 -0
- package/dist/test/mock-data.js.map +1 -0
- package/package.json +4 -4
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts +0 -9
- package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +0 -1
- package/dist/components/OptionsEditorTabs/TabPanel.js.map +0 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "OptionsEditorRadios", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>OptionsEditorRadios
|
|
20
|
+
});
|
|
21
|
+
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
+
const _material = require("@mui/material");
|
|
23
|
+
const _react = require("react");
|
|
24
|
+
const _optionsEditorTabPanel = require("../OptionsEditorTabPanel");
|
|
25
|
+
const OptionsEditorRadios = (props)=>{
|
|
26
|
+
const { tabs , defaultTab , onModeChange , isReadonly } = props;
|
|
27
|
+
const [activeTab, setActiveTab] = (0, _react.useState)(defaultTab);
|
|
28
|
+
const handleChange = (_, value)=>{
|
|
29
|
+
const v = parseInt(value);
|
|
30
|
+
setActiveTab(v);
|
|
31
|
+
onModeChange(v);
|
|
32
|
+
};
|
|
33
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Box, {
|
|
36
|
+
sx: {
|
|
37
|
+
borderBottom: 1,
|
|
38
|
+
borderColor: (theme)=>theme.palette.divider
|
|
39
|
+
},
|
|
40
|
+
children: /*#__PURE__*/ (0, _jsxRuntime.jsxs)(_material.FormControl, {
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Typography, {
|
|
43
|
+
variant: "overline",
|
|
44
|
+
component: "h4",
|
|
45
|
+
children: "Mode:"
|
|
46
|
+
}),
|
|
47
|
+
/*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.RadioGroup, {
|
|
48
|
+
row: true,
|
|
49
|
+
defaultValue: defaultTab,
|
|
50
|
+
value: activeTab,
|
|
51
|
+
onChange: handleChange,
|
|
52
|
+
"aria-labelledby": "Configuration radio",
|
|
53
|
+
children: tabs.map(({ label }, i)=>{
|
|
54
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
55
|
+
disabled: isReadonly,
|
|
56
|
+
value: i,
|
|
57
|
+
control: /*#__PURE__*/ (0, _jsxRuntime.jsx)(_material.Radio, {}),
|
|
58
|
+
label: label
|
|
59
|
+
}, label);
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
}),
|
|
65
|
+
tabs.map(({ label , content }, i)=>{
|
|
66
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorTabPanel.OptionsEditorTabPanel, {
|
|
67
|
+
value: activeTab,
|
|
68
|
+
index: i,
|
|
69
|
+
children: content
|
|
70
|
+
}, label);
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_exportStar(require("./OptionsEditorRadios"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "OptionsEditorTabPanel", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: ()=>
|
|
19
|
+
get: ()=>OptionsEditorTabPanel
|
|
20
20
|
});
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _material = require("@mui/material");
|
|
23
|
-
function
|
|
23
|
+
function OptionsEditorTabPanel(props) {
|
|
24
24
|
const { children , value , index , ...other } = props;
|
|
25
25
|
const isActive = value === index;
|
|
26
26
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)("div", {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_exportStar(require("./OptionsEditorTabPanel"), exports);
|
|
18
|
+
function _exportStar(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function() {
|
|
23
|
+
return from[k];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
return from;
|
|
28
|
+
}
|
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "OptionsEditorTabs", {
|
|
|
21
21
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
const _material = require("@mui/material");
|
|
23
23
|
const _react = require("react");
|
|
24
|
-
const
|
|
24
|
+
const _optionsEditorTabPanel = require("../OptionsEditorTabPanel");
|
|
25
25
|
const OptionsEditorTabs = ({ tabs })=>{
|
|
26
26
|
const [activeTab, setActiveTab] = (0, _react.useState)(0);
|
|
27
27
|
const handleChange = (_, newValue)=>{
|
|
@@ -48,7 +48,7 @@ const OptionsEditorTabs = ({ tabs })=>{
|
|
|
48
48
|
})
|
|
49
49
|
}),
|
|
50
50
|
tabs.map(({ label , content }, i)=>{
|
|
51
|
-
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(
|
|
51
|
+
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_optionsEditorTabPanel.OptionsEditorTabPanel, {
|
|
52
52
|
value: activeTab,
|
|
53
53
|
index: i,
|
|
54
54
|
children: content
|
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
17
|
_exportStar(require("./CalculationSelector"), exports);
|
|
18
18
|
_exportStar(require("./DatasourceSelect"), exports);
|
|
19
19
|
_exportStar(require("./LegendOptionsEditor"), exports);
|
|
20
|
+
_exportStar(require("./OptionsEditorRadios"), exports);
|
|
20
21
|
_exportStar(require("./OptionsEditorTabs"), exports);
|
|
21
22
|
_exportStar(require("./PanelSpecEditor"), exports);
|
|
22
23
|
_exportStar(require("./PluginEditor"), exports);
|
|
@@ -21,18 +21,15 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
-
useDataQueries: ()=>useDataQueries,
|
|
25
24
|
DataQueriesContext: ()=>DataQueriesContext,
|
|
26
25
|
useDataQueriesContext: ()=>useDataQueriesContext,
|
|
26
|
+
useDataQueries: ()=>useDataQueries,
|
|
27
27
|
DataQueriesProvider: ()=>DataQueriesProvider
|
|
28
28
|
});
|
|
29
29
|
const _jsxRuntime = require("react/jsx-runtime");
|
|
30
30
|
const _react = require("react");
|
|
31
31
|
const _timeSeriesQueries = require("../time-series-queries");
|
|
32
|
-
|
|
33
|
-
const ctx = useDataQueriesContext();
|
|
34
|
-
return ctx;
|
|
35
|
-
}
|
|
32
|
+
const _model = require("./model");
|
|
36
33
|
const DataQueriesContext = /*#__PURE__*/ (0, _react.createContext)(undefined);
|
|
37
34
|
function useDataQueriesContext() {
|
|
38
35
|
const ctx = (0, _react.useContext)(DataQueriesContext);
|
|
@@ -41,44 +38,59 @@ function useDataQueriesContext() {
|
|
|
41
38
|
}
|
|
42
39
|
return ctx;
|
|
43
40
|
}
|
|
41
|
+
function useDataQueries(queryType) {
|
|
42
|
+
const ctx = useDataQueriesContext();
|
|
43
|
+
// Filter the query results based on the specified query type
|
|
44
|
+
const filteredQueryResults = ctx.queryResults.filter((queryResult)=>queryResult.definition.kind === queryType);
|
|
45
|
+
// Filter the errors based on the specified query type
|
|
46
|
+
const filteredErrors = ctx.errors.filter((errors, index)=>{
|
|
47
|
+
var ref;
|
|
48
|
+
return ((ref = ctx.queryResults[index]) === null || ref === void 0 ? void 0 : ref.definition.kind) === queryType;
|
|
49
|
+
});
|
|
50
|
+
// Create a new context object with the filtered results and errors
|
|
51
|
+
const filteredCtx = {
|
|
52
|
+
queryResults: filteredQueryResults,
|
|
53
|
+
isFetching: filteredQueryResults.some((result)=>result.isFetching),
|
|
54
|
+
isLoading: filteredQueryResults.some((result)=>result.isLoading),
|
|
55
|
+
refetchAll: ctx.refetchAll,
|
|
56
|
+
errors: filteredErrors
|
|
57
|
+
};
|
|
58
|
+
return filteredCtx;
|
|
59
|
+
}
|
|
44
60
|
function DataQueriesProvider(props) {
|
|
45
61
|
const { definitions , options , children } = props;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
kind:
|
|
62
|
+
const getQueryType = (0, _model.useQueryType)();
|
|
63
|
+
const queryDefinitions = definitions.map((definition)=>{
|
|
64
|
+
const type = getQueryType(definition.kind);
|
|
65
|
+
return {
|
|
66
|
+
kind: type,
|
|
51
67
|
spec: {
|
|
52
68
|
plugin: definition
|
|
53
69
|
}
|
|
54
|
-
}));
|
|
55
|
-
const results = (0, _timeSeriesQueries.useTimeSeriesQueries)(timeSeriesQueries, options);
|
|
56
|
-
const data = results.map(({ data , isFetching , isLoading , refetch , error }, i)=>{
|
|
57
|
-
return {
|
|
58
|
-
definition: definitions[i],
|
|
59
|
-
data,
|
|
60
|
-
isFetching,
|
|
61
|
-
isLoading,
|
|
62
|
-
refetch,
|
|
63
|
-
error
|
|
64
70
|
};
|
|
65
71
|
});
|
|
72
|
+
// Filter definitions for time series query and other future query plugins
|
|
73
|
+
const timeSeriesQueries = queryDefinitions.filter((definition)=>definition.kind === 'TimeSeriesQuery');
|
|
74
|
+
const timeSeriesResults = (0, _timeSeriesQueries.useTimeSeriesQueries)(timeSeriesQueries, options);
|
|
66
75
|
const refetchAll = (0, _react.useCallback)(()=>{
|
|
67
|
-
|
|
76
|
+
timeSeriesResults.forEach((result)=>result.refetch());
|
|
68
77
|
}, [
|
|
69
|
-
|
|
78
|
+
timeSeriesResults
|
|
70
79
|
]);
|
|
71
80
|
const ctx = (0, _react.useMemo)(()=>{
|
|
81
|
+
const mergedQueryResults = [
|
|
82
|
+
...(0, _model.transformQueryResults)(timeSeriesResults, timeSeriesQueries)
|
|
83
|
+
];
|
|
72
84
|
return {
|
|
73
|
-
queryResults:
|
|
74
|
-
isFetching:
|
|
75
|
-
isLoading:
|
|
85
|
+
queryResults: mergedQueryResults,
|
|
86
|
+
isFetching: mergedQueryResults.some((result)=>result.isFetching),
|
|
87
|
+
isLoading: mergedQueryResults.some((result)=>result.isLoading),
|
|
76
88
|
refetchAll,
|
|
77
|
-
errors:
|
|
89
|
+
errors: mergedQueryResults.map((result)=>result.error)
|
|
78
90
|
};
|
|
79
91
|
}, [
|
|
80
|
-
|
|
81
|
-
|
|
92
|
+
timeSeriesQueries,
|
|
93
|
+
timeSeriesResults,
|
|
82
94
|
refetchAll
|
|
83
95
|
]);
|
|
84
96
|
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(DataQueriesContext.Provider, {
|
|
@@ -14,3 +14,60 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
transformQueryResults: ()=>transformQueryResults,
|
|
25
|
+
useQueryType: ()=>useQueryType
|
|
26
|
+
});
|
|
27
|
+
const _react = require("react");
|
|
28
|
+
const _pluginRegistry = require("../plugin-registry");
|
|
29
|
+
function transformQueryResults(results, definitions) {
|
|
30
|
+
return results.map(({ data , isFetching , isLoading , refetch , error }, i)=>{
|
|
31
|
+
return {
|
|
32
|
+
definition: definitions[i],
|
|
33
|
+
data,
|
|
34
|
+
isFetching,
|
|
35
|
+
isLoading,
|
|
36
|
+
refetch,
|
|
37
|
+
error
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function useQueryType() {
|
|
42
|
+
const { data: timeSeriesQueryPlugins , isLoading } = (0, _pluginRegistry.useListPluginMetadata)('TimeSeriesQuery');
|
|
43
|
+
const queryTypeMap = (0, _react.useMemo)(()=>{
|
|
44
|
+
const map = {
|
|
45
|
+
TimeSeriesQuery: []
|
|
46
|
+
};
|
|
47
|
+
if (timeSeriesQueryPlugins) {
|
|
48
|
+
timeSeriesQueryPlugins.forEach((plugin)=>{
|
|
49
|
+
var ref;
|
|
50
|
+
(ref = map['TimeSeriesQuery']) === null || ref === void 0 ? void 0 : ref.push(plugin.kind);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return map;
|
|
54
|
+
}, [
|
|
55
|
+
timeSeriesQueryPlugins
|
|
56
|
+
]);
|
|
57
|
+
const getQueryType = (0, _react.useCallback)((pluginKind)=>{
|
|
58
|
+
if (isLoading) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
for(const queryType in queryTypeMap){
|
|
62
|
+
var ref;
|
|
63
|
+
if ((ref = queryTypeMap[queryType]) === null || ref === void 0 ? void 0 : ref.includes(pluginKind)) {
|
|
64
|
+
return queryType;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Unable to determine the query type: ${pluginKind}`);
|
|
68
|
+
}, [
|
|
69
|
+
queryTypeMap,
|
|
70
|
+
isLoading
|
|
71
|
+
]);
|
|
72
|
+
return getQueryType;
|
|
73
|
+
}
|
|
@@ -21,12 +21,74 @@ function _export(target, all) {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
_export(exports, {
|
|
24
|
+
VariableStoreStateMap: ()=>VariableStoreStateMap,
|
|
24
25
|
TemplateVariableContext: ()=>TemplateVariableContext,
|
|
25
26
|
useTemplateVariableValues: ()=>useTemplateVariableValues,
|
|
26
27
|
useReplaceVariablesInString: ()=>useReplaceVariablesInString
|
|
27
28
|
});
|
|
28
29
|
const _react = require("react");
|
|
30
|
+
const _immer = require("immer");
|
|
29
31
|
const _utils = require("../utils");
|
|
32
|
+
let _immerable = _immer.immerable;
|
|
33
|
+
class VariableStoreStateMap {
|
|
34
|
+
/**
|
|
35
|
+
* Get variable state by key.
|
|
36
|
+
* @param key
|
|
37
|
+
*/ get(key) {
|
|
38
|
+
return this._sourceStatesOrEmpty(key.source)[key.name];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Set variable state by key.
|
|
42
|
+
* @param key
|
|
43
|
+
* @param value
|
|
44
|
+
*/ set(key, value) {
|
|
45
|
+
const sourceName = this._sourceName(key.source);
|
|
46
|
+
if (!this._state[sourceName]) {
|
|
47
|
+
this._state[sourceName] = {};
|
|
48
|
+
}
|
|
49
|
+
this._sourceStatesOrEmpty(key.source)[key.name] = value;
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check presence of variable state by key.
|
|
54
|
+
* @param key
|
|
55
|
+
*/ has(key) {
|
|
56
|
+
return this._sourceStatesOrEmpty(key.source)[key.name] !== undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Delete variable state by key.
|
|
60
|
+
* @param key
|
|
61
|
+
*/ delete(key) {
|
|
62
|
+
var ref;
|
|
63
|
+
const result = this.has(key);
|
|
64
|
+
const sourceName = this._sourceName(key.source);
|
|
65
|
+
const sourceStates = this._state[sourceName];
|
|
66
|
+
// Delete var from source state
|
|
67
|
+
if (sourceStates) {
|
|
68
|
+
delete sourceStates[key.name];
|
|
69
|
+
}
|
|
70
|
+
// Delete source state from state if empty
|
|
71
|
+
if (((ref = Object.keys(sourceStates !== null && sourceStates !== void 0 ? sourceStates : {})) === null || ref === void 0 ? void 0 : ref.length) === 0) {
|
|
72
|
+
delete this._state[sourceName];
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
_sourceName(source) {
|
|
77
|
+
return source !== null && source !== void 0 ? source : this.DEFAULT_LOCAL_SOURCE_NAME;
|
|
78
|
+
}
|
|
79
|
+
_sourceStatesOrEmpty(source) {
|
|
80
|
+
var ref;
|
|
81
|
+
return (ref = this._state[this._sourceName(source)]) !== null && ref !== void 0 ? ref : {};
|
|
82
|
+
}
|
|
83
|
+
constructor(){
|
|
84
|
+
/**
|
|
85
|
+
* "Immerable" is mandatory to be able to use this class in an immer context.
|
|
86
|
+
* Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas
|
|
87
|
+
*/ this[_immerable] = true;
|
|
88
|
+
this.DEFAULT_LOCAL_SOURCE_NAME = '';
|
|
89
|
+
this._state = {};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
30
92
|
const TemplateVariableContext = (0, _react.createContext)(undefined);
|
|
31
93
|
function useTemplateVariableContext() {
|
|
32
94
|
const ctx = (0, _react.useContext)(TemplateVariableContext);
|
package/dist/cjs/test/index.js
CHANGED
|
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
17
|
_exportStar(require("./render"), exports);
|
|
18
|
+
_exportStar(require("./mock-data"), exports);
|
|
18
19
|
function _exportStar(from, to) {
|
|
19
20
|
Object.keys(from).forEach(function(k) {
|
|
20
21
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) Object.defineProperty(to, k, {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "MOCK_TIME_SERIES_DATA", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: ()=>MOCK_TIME_SERIES_DATA
|
|
20
|
+
});
|
|
21
|
+
const MOCK_TIME_SERIES_DATA = {
|
|
22
|
+
timeRange: {
|
|
23
|
+
start: new Date(1666625490000),
|
|
24
|
+
end: new Date(1666625535000)
|
|
25
|
+
},
|
|
26
|
+
stepMs: 24379,
|
|
27
|
+
series: [
|
|
28
|
+
{
|
|
29
|
+
name: 'device="/dev/vda1", env="demo", fstype="ext4", instance="demo.do.prometheus.io:9100", job="node", mountpoint="/"',
|
|
30
|
+
values: [
|
|
31
|
+
[
|
|
32
|
+
1666479357903,
|
|
33
|
+
0.27700745551584494
|
|
34
|
+
],
|
|
35
|
+
[
|
|
36
|
+
1666479382282,
|
|
37
|
+
0.27701284657366565
|
|
38
|
+
]
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'device="/dev/vda15", env="demo", fstype="vfat", instance="demo.do.prometheus.io:9100", job="node", mountpoint="/boot/efi"',
|
|
43
|
+
values: [
|
|
44
|
+
[
|
|
45
|
+
1666479357903,
|
|
46
|
+
0.08486496097624885
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
1666479382282,
|
|
50
|
+
0.08486496097624885
|
|
51
|
+
]
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type OptionsEditorRadio = {
|
|
3
|
+
label: string;
|
|
4
|
+
/**
|
|
5
|
+
* Content rendered when the tab is active.
|
|
6
|
+
*/
|
|
7
|
+
content: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare type OptionsEditorRadiosProps = {
|
|
10
|
+
tabs: OptionsEditorRadio[];
|
|
11
|
+
defaultTab: number;
|
|
12
|
+
onModeChange: (value: number) => void;
|
|
13
|
+
isReadonly?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const OptionsEditorRadios: (props: OptionsEditorRadiosProps) => JSX.Element;
|
|
16
|
+
//# sourceMappingURL=OptionsEditorRadios.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionsEditorRadios.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsEditorRadios/OptionsEditorRadios.tsx"],"names":[],"mappings":";AAiBA,oBAAY,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC;AAEF,oBAAY,wBAAwB,GAAG;IACrC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,mBAAmB,UAAW,wBAAwB,gBAuClE,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright 2023 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, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { FormControl, FormControlLabel, Radio, RadioGroup, Box, Typography } from '@mui/material';
|
|
15
|
+
import { useState } from 'react';
|
|
16
|
+
import { OptionsEditorTabPanel } from '../OptionsEditorTabPanel';
|
|
17
|
+
export const OptionsEditorRadios = (props)=>{
|
|
18
|
+
const { tabs , defaultTab , onModeChange , isReadonly } = props;
|
|
19
|
+
const [activeTab, setActiveTab] = useState(defaultTab);
|
|
20
|
+
const handleChange = (_, value)=>{
|
|
21
|
+
const v = parseInt(value);
|
|
22
|
+
setActiveTab(v);
|
|
23
|
+
onModeChange(v);
|
|
24
|
+
};
|
|
25
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
26
|
+
children: [
|
|
27
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
28
|
+
sx: {
|
|
29
|
+
borderBottom: 1,
|
|
30
|
+
borderColor: (theme)=>theme.palette.divider
|
|
31
|
+
},
|
|
32
|
+
children: /*#__PURE__*/ _jsxs(FormControl, {
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
35
|
+
variant: "overline",
|
|
36
|
+
component: "h4",
|
|
37
|
+
children: "Mode:"
|
|
38
|
+
}),
|
|
39
|
+
/*#__PURE__*/ _jsx(RadioGroup, {
|
|
40
|
+
row: true,
|
|
41
|
+
defaultValue: defaultTab,
|
|
42
|
+
value: activeTab,
|
|
43
|
+
onChange: handleChange,
|
|
44
|
+
"aria-labelledby": "Configuration radio",
|
|
45
|
+
children: tabs.map(({ label }, i)=>{
|
|
46
|
+
return /*#__PURE__*/ _jsx(FormControlLabel, {
|
|
47
|
+
disabled: isReadonly,
|
|
48
|
+
value: i,
|
|
49
|
+
control: /*#__PURE__*/ _jsx(Radio, {}),
|
|
50
|
+
label: label
|
|
51
|
+
}, label);
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
}),
|
|
57
|
+
tabs.map(({ label , content }, i)=>{
|
|
58
|
+
return /*#__PURE__*/ _jsx(OptionsEditorTabPanel, {
|
|
59
|
+
value: activeTab,
|
|
60
|
+
index: i,
|
|
61
|
+
children: content
|
|
62
|
+
}, label);
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//# sourceMappingURL=OptionsEditorRadios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorRadios/OptionsEditorRadios.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 { FormControl, FormControlLabel, Radio, RadioGroup, RadioGroupProps, Box, Typography } from '@mui/material';\nimport { useState } from 'react';\nimport { OptionsEditorTabPanel } from '../OptionsEditorTabPanel';\n\nexport type OptionsEditorRadio = {\n label: string;\n /**\n * Content rendered when the tab is active.\n */\n content: React.ReactNode;\n};\n\nexport type OptionsEditorRadiosProps = {\n tabs: OptionsEditorRadio[];\n defaultTab: number;\n onModeChange: (value: number) => void;\n isReadonly?: boolean;\n};\n\nexport const OptionsEditorRadios = (props: OptionsEditorRadiosProps) => {\n const { tabs, defaultTab, onModeChange, isReadonly } = props;\n const [activeTab, setActiveTab] = useState(defaultTab);\n\n const handleChange: RadioGroupProps['onChange'] = (_, value) => {\n const v = parseInt(value);\n setActiveTab(v);\n onModeChange(v);\n };\n\n return (\n <>\n <Box sx={{ borderBottom: 1, borderColor: (theme) => theme.palette.divider }}>\n <FormControl>\n <Typography variant=\"overline\" component=\"h4\">\n Mode:\n </Typography>\n <RadioGroup\n row\n defaultValue={defaultTab}\n value={activeTab}\n onChange={handleChange}\n aria-labelledby=\"Configuration radio\"\n >\n {tabs.map(({ label }, i) => {\n return <FormControlLabel disabled={isReadonly} key={label} value={i} control={<Radio />} label={label} />;\n })}\n </RadioGroup>\n </FormControl>\n </Box>\n {tabs.map(({ label, content }, i) => {\n return (\n <OptionsEditorTabPanel key={label} value={activeTab} index={i}>\n {content}\n </OptionsEditorTabPanel>\n );\n })}\n </>\n );\n};\n"],"names":["FormControl","FormControlLabel","Radio","RadioGroup","Box","Typography","useState","OptionsEditorTabPanel","OptionsEditorRadios","props","tabs","defaultTab","onModeChange","isReadonly","activeTab","setActiveTab","handleChange","_","value","v","parseInt","sx","borderBottom","borderColor","theme","palette","divider","variant","component","row","defaultValue","onChange","aria-labelledby","map","label","i","disabled","control","content","index"],"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,WAAW,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,UAAU,EAAmBC,GAAG,EAAEC,UAAU,QAAQ,eAAe,CAAC;AACnH,SAASC,QAAQ,QAAQ,OAAO,CAAC;AACjC,SAASC,qBAAqB,QAAQ,0BAA0B,CAAC;AAiBjE,OAAO,MAAMC,mBAAmB,GAAG,CAACC,KAA+B,GAAK;IACtE,MAAM,EAAEC,IAAI,CAAA,EAAEC,UAAU,CAAA,EAAEC,YAAY,CAAA,EAAEC,UAAU,CAAA,EAAE,GAAGJ,KAAK,AAAC;IAC7D,MAAM,CAACK,SAAS,EAAEC,YAAY,CAAC,GAAGT,QAAQ,CAACK,UAAU,CAAC,AAAC;IAEvD,MAAMK,YAAY,GAAgC,CAACC,CAAC,EAAEC,KAAK,GAAK;QAC9D,MAAMC,CAAC,GAAGC,QAAQ,CAACF,KAAK,CAAC,AAAC;QAC1BH,YAAY,CAACI,CAAC,CAAC,CAAC;QAChBP,YAAY,CAACO,CAAC,CAAC,CAAC;IAClB,CAAC,AAAC;IAEF,qBACE;;0BACE,KAACf,GAAG;gBAACiB,EAAE,EAAE;oBAAEC,YAAY,EAAE,CAAC;oBAAEC,WAAW,EAAE,CAACC,KAAK,GAAKA,KAAK,CAACC,OAAO,CAACC,OAAO;iBAAE;0BACzE,cAAA,MAAC1B,WAAW;;sCACV,KAACK,UAAU;4BAACsB,OAAO,EAAC,UAAU;4BAACC,SAAS,EAAC,IAAI;sCAAC,OAE9C;0BAAa;sCACb,KAACzB,UAAU;4BACT0B,GAAG;4BACHC,YAAY,EAAEnB,UAAU;4BACxBO,KAAK,EAAEJ,SAAS;4BAChBiB,QAAQ,EAAEf,YAAY;4BACtBgB,iBAAe,EAAC,qBAAqB;sCAEpCtB,IAAI,CAACuB,GAAG,CAAC,CAAC,EAAEC,KAAK,CAAA,EAAE,EAAEC,CAAC,GAAK;gCAC1B,qBAAO,KAAClC,gBAAgB;oCAACmC,QAAQ,EAAEvB,UAAU;oCAAcK,KAAK,EAAEiB,CAAC;oCAAEE,OAAO,gBAAE,KAACnC,KAAK,KAAG;oCAAEgC,KAAK,EAAEA,KAAK;mCAAjDA,KAAK,CAAgD,CAAC;4BAC5G,CAAC,CAAC;0BACS;;kBACD;cACV;YACLxB,IAAI,CAACuB,GAAG,CAAC,CAAC,EAAEC,KAAK,CAAA,EAAEI,OAAO,CAAA,EAAE,EAAEH,CAAC,GAAK;gBACnC,qBACE,KAAC5B,qBAAqB;oBAAaW,KAAK,EAAEJ,SAAS;oBAAEyB,KAAK,EAAEJ,CAAC;8BAC1DG,OAAO;mBADkBJ,KAAK,CAET,CACxB;YACJ,CAAC,CAAC;;MACD,CACH;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsEditorRadios/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2023 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 './OptionsEditorRadios';
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorRadios/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 './OptionsEditorRadios';\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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface OptionsEditorTabPanelProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
index: number;
|
|
5
|
+
value: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function OptionsEditorTabPanel(props: OptionsEditorTabPanelProps): JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=OptionsEditorTabPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionsEditorTabPanel.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsEditorTabPanel/OptionsEditorTabPanel.tsx"],"names":[],"mappings":";AAeA,UAAU,0BAA0B;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eAgBtE"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { Box } from '@mui/material';
|
|
15
|
-
export function
|
|
15
|
+
export function OptionsEditorTabPanel(props) {
|
|
16
16
|
const { children , value , index , ...other } = props;
|
|
17
17
|
const isActive = value === index;
|
|
18
18
|
return /*#__PURE__*/ _jsx("div", {
|
|
@@ -28,4 +28,4 @@ export function TabPanel(props) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
//# sourceMappingURL=
|
|
31
|
+
//# sourceMappingURL=OptionsEditorTabPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/OptionsEditorTabPanel.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 { Box } from '@mui/material';\n\ninterface OptionsEditorTabPanelProps {\n children: React.ReactNode;\n index: number;\n value: number;\n}\n\nexport function OptionsEditorTabPanel(props: OptionsEditorTabPanelProps) {\n const { children, value, index, ...other } = props;\n\n const isActive = value === index;\n\n return (\n <div\n role=\"tabpanel\"\n hidden={!isActive}\n id={`options-editor-tabpanel-${index}`}\n aria-labelledby={`options-editor-tab-${index}`}\n {...other}\n >\n {isActive && <Box mt={2}>{children}</Box>}\n </div>\n );\n}\n"],"names":["Box","OptionsEditorTabPanel","props","children","value","index","other","isActive","div","role","hidden","id","aria-labelledby","mt"],"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,GAAG,QAAQ,eAAe,CAAC;AAQpC,OAAO,SAASC,qBAAqB,CAACC,KAAiC,EAAE;IACvE,MAAM,EAAEC,QAAQ,CAAA,EAAEC,KAAK,CAAA,EAAEC,KAAK,CAAA,EAAE,GAAGC,KAAK,EAAE,GAAGJ,KAAK,AAAC;IAEnD,MAAMK,QAAQ,GAAGH,KAAK,KAAKC,KAAK,AAAC;IAEjC,qBACE,KAACG,KAAG;QACFC,IAAI,EAAC,UAAU;QACfC,MAAM,EAAE,CAACH,QAAQ;QACjBI,EAAE,EAAE,CAAC,wBAAwB,EAAEN,KAAK,CAAC,CAAC;QACtCO,iBAAe,EAAE,CAAC,mBAAmB,EAAEP,KAAK,CAAC,CAAC;QAC7C,GAAGC,KAAK;kBAERC,QAAQ,kBAAI,KAACP,GAAG;YAACa,EAAE,EAAE,CAAC;sBAAGV,QAAQ;UAAO;MACrC,CACN;AACJ,CAAC"}
|