@perses-dev/plugin-system 0.0.0-snapshot-panel-extra-content-2-2767e21 → 0.0.0-snapshot-panel-extra-content-3-17f9c42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/cjs/components/OptionsEditorRadios/OptionsEditorRadios.js +74 -0
  2. package/dist/cjs/components/OptionsEditorRadios/index.js +28 -0
  3. package/dist/cjs/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +3 -3
  4. package/dist/cjs/components/OptionsEditorTabPanel/index.js +28 -0
  5. package/dist/cjs/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
  6. package/dist/cjs/components/index.js +1 -0
  7. package/dist/cjs/runtime/template-variables.js +62 -0
  8. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts +16 -0
  9. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.d.ts.map +1 -0
  10. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js +68 -0
  11. package/dist/components/OptionsEditorRadios/OptionsEditorRadios.js.map +1 -0
  12. package/dist/components/OptionsEditorRadios/index.d.ts +2 -0
  13. package/dist/components/OptionsEditorRadios/index.d.ts.map +1 -0
  14. package/dist/components/OptionsEditorRadios/index.js +15 -0
  15. package/dist/components/OptionsEditorRadios/index.js.map +1 -0
  16. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts +9 -0
  17. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.d.ts.map +1 -0
  18. package/dist/components/{OptionsEditorTabs/TabPanel.js → OptionsEditorTabPanel/OptionsEditorTabPanel.js} +2 -2
  19. package/dist/components/OptionsEditorTabPanel/OptionsEditorTabPanel.js.map +1 -0
  20. package/dist/components/OptionsEditorTabPanel/index.d.ts +2 -0
  21. package/dist/components/OptionsEditorTabPanel/index.d.ts.map +1 -0
  22. package/dist/components/OptionsEditorTabPanel/index.js +15 -0
  23. package/dist/components/OptionsEditorTabPanel/index.js.map +1 -0
  24. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js +2 -2
  25. package/dist/components/OptionsEditorTabs/OptionsEditorTabs.js.map +1 -1
  26. package/dist/components/index.d.ts +1 -0
  27. package/dist/components/index.d.ts.map +1 -1
  28. package/dist/components/index.js +1 -0
  29. package/dist/components/index.js.map +1 -1
  30. package/dist/runtime/template-variables.d.ts +61 -2
  31. package/dist/runtime/template-variables.d.ts.map +1 -1
  32. package/dist/runtime/template-variables.js +63 -0
  33. package/dist/runtime/template-variables.js.map +1 -1
  34. package/package.json +4 -4
  35. package/dist/components/OptionsEditorTabs/TabPanel.d.ts +0 -9
  36. package/dist/components/OptionsEditorTabs/TabPanel.d.ts.map +0 -1
  37. 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, "TabPanel", {
17
+ Object.defineProperty(exports, "OptionsEditorTabPanel", {
18
18
  enumerable: true,
19
- get: ()=>TabPanel
19
+ get: ()=>OptionsEditorTabPanel
20
20
  });
21
21
  const _jsxRuntime = require("react/jsx-runtime");
22
22
  const _material = require("@mui/material");
23
- function TabPanel(props) {
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 _tabPanel = require("./TabPanel");
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)(_tabPanel.TabPanel, {
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,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);
@@ -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,2 @@
1
+ export * from './OptionsEditorRadios';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -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 TabPanel(props) {
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=TabPanel.js.map
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"}
@@ -0,0 +1,2 @@
1
+ export * from './OptionsEditorTabPanel';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsEditorTabPanel/index.ts"],"names":[],"mappings":"AAaA,cAAc,yBAAyB,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 './OptionsEditorTabPanel';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/OptionsEditorTabPanel/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 './OptionsEditorTabPanel';\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,yBAAyB,CAAC"}
@@ -13,7 +13,7 @@
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import { Tab, Tabs, Box } from '@mui/material';
15
15
  import { useState } from 'react';
16
- import { TabPanel } from './TabPanel';
16
+ import { OptionsEditorTabPanel } from '../OptionsEditorTabPanel';
17
17
  export const OptionsEditorTabs = ({ tabs })=>{
18
18
  const [activeTab, setActiveTab] = useState(0);
19
19
  const handleChange = (_, newValue)=>{
@@ -40,7 +40,7 @@ export const OptionsEditorTabs = ({ tabs })=>{
40
40
  })
41
41
  }),
42
42
  tabs.map(({ label , content }, i)=>{
43
- return /*#__PURE__*/ _jsx(TabPanel, {
43
+ return /*#__PURE__*/ _jsx(OptionsEditorTabPanel, {
44
44
  value: activeTab,
45
45
  index: i,
46
46
  children: content
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.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 { Tab, Tabs, TabsProps, Box } from '@mui/material';\nimport { useState } from 'react';\nimport { TabPanel } from './TabPanel';\n\nexport type OptionsEditorTab = {\n label: string;\n /**\n * Content rendered when the tab is active.\n */\n content: React.ReactNode;\n};\n\nexport type OptionsEditorTabsProps = {\n tabs: OptionsEditorTab[];\n};\n\nexport const OptionsEditorTabs = ({ tabs }: OptionsEditorTabsProps) => {\n const [activeTab, setActiveTab] = useState(0);\n\n const handleChange: TabsProps['onChange'] = (_, newValue) => {\n setActiveTab(newValue);\n };\n\n return (\n <>\n <Box sx={{ borderBottom: 1, borderColor: (theme) => theme.palette.divider }}>\n <Tabs value={activeTab} onChange={handleChange} aria-label=\"Panel configuration tabs\">\n {tabs.map(({ label }, i) => {\n return (\n <Tab\n key={label}\n label={label}\n id={`options-editor-tab-${i}`}\n aria-controls={`options-editor-tabpanel-${i}`}\n />\n );\n })}\n </Tabs>\n </Box>\n {tabs.map(({ label, content }, i) => {\n return (\n <TabPanel key={label} value={activeTab} index={i}>\n {content}\n </TabPanel>\n );\n })}\n </>\n );\n};\n"],"names":["Tab","Tabs","Box","useState","TabPanel","OptionsEditorTabs","tabs","activeTab","setActiveTab","handleChange","_","newValue","sx","borderBottom","borderColor","theme","palette","divider","value","onChange","aria-label","map","label","i","id","aria-controls","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,GAAG,EAAEC,IAAI,EAAaC,GAAG,QAAQ,e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["../../../src/components/OptionsEditorTabs/OptionsEditorTabs.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 { Tab, Tabs, TabsProps, Box } from '@mui/material';\nimport { useState } from 'react';\nimport { OptionsEditorTabPanel } from '../OptionsEditorTabPanel';\n\nexport type OptionsEditorTab = {\n label: string;\n /**\n * Content rendered when the tab is active.\n */\n content: React.ReactNode;\n};\n\nexport type OptionsEditorTabsProps = {\n tabs: OptionsEditorTab[];\n};\n\nexport const OptionsEditorTabs = ({ tabs }: OptionsEditorTabsProps) => {\n const [activeTab, setActiveTab] = useState(0);\n\n const handleChange: TabsProps['onChange'] = (_, newValue) => {\n setActiveTab(newValue);\n };\n\n return (\n <>\n <Box sx={{ borderBottom: 1, borderColor: (theme) => theme.palette.divider }}>\n <Tabs value={activeTab} onChange={handleChange} aria-label=\"Panel configuration tabs\">\n {tabs.map(({ label }, i) => {\n return (\n <Tab\n key={label}\n label={label}\n id={`options-editor-tab-${i}`}\n aria-controls={`options-editor-tabpanel-${i}`}\n />\n );\n })}\n </Tabs>\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":["Tab","Tabs","Box","useState","OptionsEditorTabPanel","OptionsEditorTabs","tabs","activeTab","setActiveTab","handleChange","_","newValue","sx","borderBottom","borderColor","theme","palette","divider","value","onChange","aria-label","map","label","i","id","aria-controls","content","index"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACn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BACnC,qBACE,KAACnB,qBAAqB;oBAAac,KAAK,EAAEX,SAAS;oBAAEoB,KAAK,EAAEJ,CAAC;8BAC1DG,OAAO;mBADkBJ,KAAK,CAET,CACxB;YACJ,CAAC,CAAC;;MACD,CACH;AACJ,CAAC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export * from './CalculationSelector';
2
2
  export * from './DatasourceSelect';
3
3
  export * from './LegendOptionsEditor';
4
+ export * from './OptionsEditorRadios';
4
5
  export * from './OptionsEditorTabs';
5
6
  export * from './PanelSpecEditor';
6
7
  export * from './PluginEditor';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
@@ -13,6 +13,7 @@
13
13
  export * from './CalculationSelector';
14
14
  export * from './DatasourceSelect';
15
15
  export * from './LegendOptionsEditor';
16
+ export * from './OptionsEditorRadios';
16
17
  export * from './OptionsEditorTabs';
17
18
  export * from './PanelSpecEditor';
18
19
  export * from './PluginEditor';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/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';\nexport * from './DatasourceSelect';\nexport * from './LegendOptionsEditor';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeSeriesQueryEditor';\nexport * from './Variables';\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;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"sources":["../../src/components/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';\nexport * from './DatasourceSelect';\nexport * from './LegendOptionsEditor';\nexport * from './OptionsEditorRadios';\nexport * from './OptionsEditorTabs';\nexport * from './PanelSpecEditor';\nexport * from './PluginEditor';\nexport * from './PluginKindSelect';\nexport * from './PluginRegistry';\nexport * from './PluginSpecEditor';\nexport * from './TimeSeriesQueryEditor';\nexport * from './Variables';\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;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC"}
@@ -1,13 +1,72 @@
1
1
  /// <reference types="react" />
2
- import { VariableName, VariableValue } from '@perses-dev/core';
2
+ import { VariableValue } from '@perses-dev/core';
3
+ import { immerable } from 'immer';
3
4
  import { VariableOption } from '../model';
4
5
  export declare type VariableState = {
5
6
  value: VariableValue;
6
7
  options?: VariableOption[];
7
8
  loading: boolean;
8
9
  error?: Error;
10
+ /**
11
+ * If a local variable is overriding an external variable, local var will have the flag ``overriding=true``.
12
+ */
13
+ overriding?: boolean;
14
+ /**
15
+ * If a local variable is overriding an external variable, external var will have the flag ``overridden=true``.
16
+ */
17
+ overridden?: boolean;
18
+ default_value?: VariableValue;
9
19
  };
10
- export declare type VariableStateMap = Record<VariableName, VariableState>;
20
+ export declare type VariableStateMap = Record<string, VariableState>;
21
+ /**
22
+ * Structure used as key in the {@link VariableStoreStateMap}.
23
+ */
24
+ export declare type VariableStateKey = {
25
+ /**
26
+ * name of the variable we want to access in the state.
27
+ */
28
+ name: string;
29
+ /**
30
+ * source of the variable we want to access in the state.
31
+ * Defined only for external variables.
32
+ */
33
+ source?: string;
34
+ };
35
+ /**
36
+ * A state map with two entry keys, materialized by {@link VariableStateKey} structure.
37
+ */
38
+ export declare class VariableStoreStateMap {
39
+ /**
40
+ * "Immerable" is mandatory to be able to use this class in an immer context.
41
+ * Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas
42
+ */
43
+ [immerable]: boolean;
44
+ private readonly DEFAULT_LOCAL_SOURCE_NAME;
45
+ private readonly _state;
46
+ /**
47
+ * Get variable state by key.
48
+ * @param key
49
+ */
50
+ get(key: VariableStateKey): VariableState | undefined;
51
+ /**
52
+ * Set variable state by key.
53
+ * @param key
54
+ * @param value
55
+ */
56
+ set(key: VariableStateKey, value: VariableState): VariableState | undefined;
57
+ /**
58
+ * Check presence of variable state by key.
59
+ * @param key
60
+ */
61
+ has(key: VariableStateKey): boolean;
62
+ /**
63
+ * Delete variable state by key.
64
+ * @param key
65
+ */
66
+ delete(key: VariableStateKey): boolean;
67
+ private _sourceName;
68
+ private _sourceStatesOrEmpty;
69
+ }
11
70
  export declare type TemplateVariableSrv = {
12
71
  state: VariableStateMap;
13
72
  };
@@ -1 +1 @@
1
- {"version":3,"file":"template-variables.d.ts","sourceRoot":"","sources":["../../src/runtime/template-variables.ts"],"names":[],"mappings":";AAcA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,C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;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,qBAAa,qBAAqB;IAChC;;;OAGG;IACH,CAAC,SAAS,CAAC,UAAQ;IAEnB,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAM;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqD;IAE5E;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,aAAa,GAAG,SAAS;IAIrD;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,GAAG,aAAa,GAAG,SAAS;IAS3E;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO;IAInC;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO;IAiBtC,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,oBAAoB;CAG7B;AAED,oBAAY,mBAAmB,GAAG;IAChC,KAAK,EAAE,gBAAgB,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,0DAA4D,CAAC;AAUjG,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,oBAmBzD;AAGD,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKvF"}
@@ -11,7 +11,70 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { createContext, useContext, useMemo } from 'react';
14
+ import { immerable } from 'immer';
14
15
  import { parseTemplateVariables, replaceTemplateVariables } from '../utils';
16
+ let _immerable = immerable;
17
+ /**
18
+ * A state map with two entry keys, materialized by {@link VariableStateKey} structure.
19
+ */ export class VariableStoreStateMap {
20
+ /**
21
+ * Get variable state by key.
22
+ * @param key
23
+ */ get(key) {
24
+ return this._sourceStatesOrEmpty(key.source)[key.name];
25
+ }
26
+ /**
27
+ * Set variable state by key.
28
+ * @param key
29
+ * @param value
30
+ */ set(key, value) {
31
+ const sourceName = this._sourceName(key.source);
32
+ if (!this._state[sourceName]) {
33
+ this._state[sourceName] = {};
34
+ }
35
+ this._sourceStatesOrEmpty(key.source)[key.name] = value;
36
+ return value;
37
+ }
38
+ /**
39
+ * Check presence of variable state by key.
40
+ * @param key
41
+ */ has(key) {
42
+ return this._sourceStatesOrEmpty(key.source)[key.name] !== undefined;
43
+ }
44
+ /**
45
+ * Delete variable state by key.
46
+ * @param key
47
+ */ delete(key) {
48
+ var ref;
49
+ const result = this.has(key);
50
+ const sourceName = this._sourceName(key.source);
51
+ const sourceStates = this._state[sourceName];
52
+ // Delete var from source state
53
+ if (sourceStates) {
54
+ delete sourceStates[key.name];
55
+ }
56
+ // Delete source state from state if empty
57
+ if (((ref = Object.keys(sourceStates !== null && sourceStates !== void 0 ? sourceStates : {})) === null || ref === void 0 ? void 0 : ref.length) === 0) {
58
+ delete this._state[sourceName];
59
+ }
60
+ return result;
61
+ }
62
+ _sourceName(source) {
63
+ return source !== null && source !== void 0 ? source : this.DEFAULT_LOCAL_SOURCE_NAME;
64
+ }
65
+ _sourceStatesOrEmpty(source) {
66
+ var ref;
67
+ return (ref = this._state[this._sourceName(source)]) !== null && ref !== void 0 ? ref : {};
68
+ }
69
+ constructor(){
70
+ /**
71
+ * "Immerable" is mandatory to be able to use this class in an immer context.
72
+ * Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas
73
+ */ this[_immerable] = true;
74
+ this.DEFAULT_LOCAL_SOURCE_NAME = '';
75
+ this._state = {};
76
+ }
77
+ }
15
78
  export const TemplateVariableContext = createContext(undefined);
16
79
  function useTemplateVariableContext() {
17
80
  const ctx = useContext(TemplateVariableContext);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/runtime/template-variables.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\nimport { createContext, useContext, useMemo } from 'react';\nimport { VariableName, VariableValue } from '@perses-dev/core';\nimport { VariableOption } from '../model';\nimport { parseTemplateVariables, replaceTemplateVariables } from '../utils';\n\nexport type VariableState = {\n value: VariableValue;\n options?: VariableOption[];\n loading: boolean;\n error?: Error;\n};\n\nexport type VariableStateMap = Record<VariableName, VariableState>;\n\nexport type TemplateVariableSrv = {\n state: VariableStateMap;\n};\n\nexport const TemplateVariableContext = createContext<TemplateVariableSrv | undefined>(undefined);\n\nfunction useTemplateVariableContext() {\n const ctx = useContext(TemplateVariableContext);\n if (ctx === undefined) {\n throw new Error('No TemplateVariableContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useTemplateVariableValues(names?: string[]) {\n const { state } = useTemplateVariableContext();\n\n const values = useMemo(() => {\n const values: VariableStateMap = {};\n names?.forEach((name) => {\n const s = state[name];\n if (s) {\n values[name] = s;\n }\n });\n return values;\n }, [state, names]);\n\n if (names === undefined) {\n return state;\n }\n\n return values;\n}\n\n// Convenience hook for replacing template variables in a string\nexport function useReplaceVariablesInString(str: string | undefined): string | undefined {\n const variablesInString = str ? parseTemplateVariables(str) : [];\n const variableValues = useTemplateVariableValues(variablesInString);\n if (!str) return undefined;\n return replaceTemplateVariables(str, variableValues);\n}\n"],"names":["createContext","useContext","useMemo","parseTemplateVariables","replaceTemplateVariables","TemplateVariableContext","undefined","useTemplateVariableContext","ctx","Error","useTemplateVariableValues","names","state","values","forEach","name","s","useReplaceVariablesInString","str","variablesInString","variableValues"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAs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,GAAGf,sBAAsB,CAACe,GAAG,CAAC,GAAG,EAAE,AAAC;IACjE,MAAME,cAAc,GAAGV,yBAAyB,CAACS,iBAAiB,CAAC,AAAC;IACpE,IAAI,CAACD,GAAG,EAAE,OAAOZ,SAAS,CAAC;IAC3B,OAAOF,wBAAwB,CAACc,GAAG,EAAEE,cAAc,CAAC,CAAC;AACvD,CAAC"}
1
+ {"version":3,"sources":["../../src/runtime/template-variables.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\nimport { createContext, useContext, useMemo } from 'react';\nimport { VariableValue } from '@perses-dev/core';\nimport { immerable } from 'immer';\nimport { VariableOption } from '../model';\nimport { parseTemplateVariables, replaceTemplateVariables } from '../utils';\n\nexport type VariableState = {\n value: VariableValue;\n options?: VariableOption[];\n loading: boolean;\n error?: Error;\n /**\n * If a local variable is overriding an external variable, local var will have the flag ``overriding=true``.\n */\n overriding?: boolean;\n /**\n * If a local variable is overriding an external variable, external var will have the flag ``overridden=true``.\n */\n overridden?: boolean;\n default_value?: VariableValue;\n};\n\nexport type VariableStateMap = Record<string, VariableState>;\n\n/**\n * Structure used as key in the {@link VariableStoreStateMap}.\n */\nexport type VariableStateKey = {\n /**\n * name of the variable we want to access in the state.\n */\n name: string;\n /**\n * source of the variable we want to access in the state.\n * Defined only for external variables.\n */\n source?: string;\n};\n\n/**\n * A state map with two entry keys, materialized by {@link VariableStateKey} structure.\n */\nexport class VariableStoreStateMap {\n /**\n * \"Immerable\" is mandatory to be able to use this class in an immer context.\n * Ref: https://docs.pmnd.rs/zustand/integrations/immer-middleware#gotchas\n */\n [immerable] = true;\n\n private readonly DEFAULT_LOCAL_SOURCE_NAME = '';\n private readonly _state: Record<string, Record<string, VariableState>> = {};\n\n /**\n * Get variable state by key.\n * @param key\n */\n get(key: VariableStateKey): VariableState | undefined {\n return this._sourceStatesOrEmpty(key.source)[key.name];\n }\n\n /**\n * Set variable state by key.\n * @param key\n * @param value\n */\n set(key: VariableStateKey, value: VariableState): VariableState | undefined {\n const sourceName = this._sourceName(key.source);\n if (!this._state[sourceName]) {\n this._state[sourceName] = {};\n }\n this._sourceStatesOrEmpty(key.source)[key.name] = value;\n return value;\n }\n\n /**\n * Check presence of variable state by key.\n * @param key\n */\n has(key: VariableStateKey): boolean {\n return this._sourceStatesOrEmpty(key.source)[key.name] !== undefined;\n }\n\n /**\n * Delete variable state by key.\n * @param key\n */\n delete(key: VariableStateKey): boolean {\n const result = this.has(key);\n const sourceName = this._sourceName(key.source);\n const sourceStates = this._state[sourceName];\n\n // Delete var from source state\n if (sourceStates) {\n delete sourceStates[key.name];\n }\n\n // Delete source state from state if empty\n if (Object.keys(sourceStates ?? {})?.length === 0) {\n delete this._state[sourceName];\n }\n return result;\n }\n\n private _sourceName(source: string | undefined): string {\n return source ?? this.DEFAULT_LOCAL_SOURCE_NAME;\n }\n\n private _sourceStatesOrEmpty(source: string | undefined): Record<string, VariableState> {\n return this._state[this._sourceName(source)] ?? {};\n }\n}\n\nexport type TemplateVariableSrv = {\n state: VariableStateMap;\n};\n\nexport const TemplateVariableContext = createContext<TemplateVariableSrv | undefined>(undefined);\n\nfunction useTemplateVariableContext() {\n const ctx = useContext(TemplateVariableContext);\n if (ctx === undefined) {\n throw new Error('No TemplateVariableContext found. Did you forget a Provider?');\n }\n return ctx;\n}\n\nexport function useTemplateVariableValues(names?: string[]) {\n const { state } = useTemplateVariableContext();\n\n const values = useMemo(() => {\n const values: VariableStateMap = {};\n names?.forEach((name) => {\n const s = state[name];\n if (s) {\n values[name] = s;\n }\n });\n return values;\n }, [state, names]);\n\n if (names === undefined) {\n return state;\n }\n\n return values;\n}\n\n// Convenience hook for replacing template variables in a string\nexport function useReplaceVariablesInString(str: string | undefined): string | undefined {\n const variablesInString = str ? parseTemplateVariables(str) : [];\n const variableValues = useTemplateVariableValues(variablesInString);\n if (!str) return undefined;\n return replaceTemplateVariables(str, variableValues);\n}\n"],"names":["createContext","useContext","useMemo","immerable","parseTemplateVariables","replaceTemplateVariables","VariableStoreStateMap","get","key","_sourceStatesOrEmpty","source","name","set","value","sourceName","_sourceName","_state","has","undefined","delete","Object","result","sourceStates","keys","length","DEFAULT_LOCAL_SOURCE_NAME","TemplateVariableContext","useTemplateVariableContext","ctx","Error","useTemplateVariableValues","names","state","values","forEach","s","useReplaceVariablesInString","str","variablesInString","variableValues"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,aAAa,EAAEC,UAAU,EAAEC,OAAO,QAAQ,OAAO,CAAC;AAE3D,SAASC,SAAS,QAAQ,OAAO,CAAC;AAElC,SAASC,sBAAsB,EAAEC,wBAAwB,QAAQ,UAAU,CAAC;IA2CzEF,UAAS,GAATA,SAAS;AARZ;;CAEC,GACD,OAAO,MAAMG,qBAAqB;IAUhC;;;GAGC,GACDC,GAAG,CAACC,GAAqB,EAA6B;QACpD,OAAO,IAAI,CAACC,oBAAoB,CAACD,GAAG,CAACE,MAAM,CAAC,CAACF,GAAG,CAACG,IAAI,CAAC,CAAC;IACzD;IAEA;;;;GAIC,GACDC,GAAG,CAACJ,GAAqB,EAAEK,KAAoB,EAA6B;QAC1E,MAAMC,UAAU,GAAG,IAAI,CAACC,WAAW,CAACP,GAAG,CAACE,MAAM,CAAC,AAAC;QAChD,IAAI,CAAC,IAAI,CAACM,MAAM,CAACF,UAAU,CAAC,EAAE;YAC5B,IAAI,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AAK,CAAC;IACf,CAAC;IAED,OAAOC,MAAM,CAAC;AAChB,CAAC;AAED,gEAAgE;AAChE,OAAO,SAASG,2BAA2B,CAACC,GAAuB,EAAsB;IACvF,MAAMC,iBAAiB,GAAGD,GAAG,GAAGjC,sBAAsB,CAACiC,GAAG,CAAC,GAAG,EAAE,AAAC;IACjE,MAAME,cAAc,GAAGT,yBAAyB,CAACQ,iBAAiB,CAAC,AAAC;IACpE,IAAI,CAACD,GAAG,EAAE,OAAOnB,SAAS,CAAC;IAC3B,OAAOb,wBAAwB,CAACgC,GAAG,EAAEE,cAAc,CAAC,CAAC;AACvD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/plugin-system",
3
- "version": "0.0.0-snapshot-panel-extra-content-2-2767e21",
3
+ "version": "0.0.0-snapshot-panel-extra-content-3-17f9c42",
4
4
  "description": "The plugin feature in Pereses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -28,14 +28,14 @@
28
28
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
29
29
  },
30
30
  "dependencies": {
31
- "@perses-dev/components": "0.0.0-snapshot-panel-extra-content-2-2767e21",
32
- "@perses-dev/core": "0.0.0-snapshot-panel-extra-content-2-2767e21",
31
+ "@perses-dev/components": "0.0.0-snapshot-panel-extra-content-3-17f9c42",
32
+ "@perses-dev/core": "0.0.0-snapshot-panel-extra-content-3-17f9c42",
33
33
  "immer": "^9.0.15",
34
34
  "use-immer": "^0.7.0",
35
35
  "use-query-params": "^2.1.2"
36
36
  },
37
37
  "devDependencies": {
38
- "@perses-dev/storybook": "0.0.0-snapshot-panel-extra-content-2-2767e21"
38
+ "@perses-dev/storybook": "0.0.0-snapshot-panel-extra-content-3-17f9c42"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@mui/material": "^5.10.0",
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- interface TabPanelProps {
3
- children: React.ReactNode;
4
- index: number;
5
- value: number;
6
- }
7
- export declare function TabPanel(props: TabPanelProps): JSX.Element;
8
- export {};
9
- //# sourceMappingURL=TabPanel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TabPanel.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsEditorTabs/TabPanel.tsx"],"names":[],"mappings":";AAeA,UAAU,aAAa;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,eAgB5C"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/OptionsEditorTabs/TabPanel.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 TabPanelProps {\n children: React.ReactNode;\n index: number;\n value: number;\n}\n\nexport function TabPanel(props: TabPanelProps) {\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","TabPanel","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,QAAQ,CAACC,KAAoB,EAAE;IAC7C,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"}