@perses-dev/plugin-system 0.52.0-beta.1 → 0.52.0-beta.3
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/LegendOptionsEditor/LegendOptionsEditor.js +48 -21
- package/dist/cjs/model/legend.js +13 -0
- package/dist/cjs/remote/PluginRuntime.js +3 -2
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts +2 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.d.ts.map +1 -1
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js +49 -22
- package/dist/components/LegendOptionsEditor/LegendOptionsEditor.js.map +1 -1
- package/dist/model/legend.d.ts +3 -1
- package/dist/model/legend.d.ts.map +1 -1
- package/dist/model/legend.js +10 -0
- package/dist/model/legend.js.map +1 -1
- package/dist/remote/PluginRuntime.d.ts +2 -2
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.js +4 -3
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/package.json +6 -6
|
@@ -24,6 +24,7 @@ const _jsxruntime = require("react/jsx-runtime");
|
|
|
24
24
|
const _material = require("@mui/material");
|
|
25
25
|
const _core = require("@perses-dev/core");
|
|
26
26
|
const _components = require("@perses-dev/components");
|
|
27
|
+
const _react = require("react");
|
|
27
28
|
const _model = require("../../model");
|
|
28
29
|
const POSITION_OPTIONS = Object.entries(_model.LEGEND_POSITIONS_CONFIG).map(([id, config])=>{
|
|
29
30
|
return {
|
|
@@ -43,13 +44,7 @@ const SIZE_OPTIONS = Object.entries(_model.LEGEND_SIZE_CONFIG).map(([id, config]
|
|
|
43
44
|
...config
|
|
44
45
|
};
|
|
45
46
|
});
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
id: id,
|
|
49
|
-
...config
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
function LegendOptionsEditor({ value, onChange, showValuesEditor = true }) {
|
|
47
|
+
function LegendOptionsEditor({ value, onChange, showValuesEditor = true, calculation = 'aggregation' }) {
|
|
53
48
|
const handleLegendShowChange = (_, checked)=>{
|
|
54
49
|
// legend is hidden when legend obj is undefined
|
|
55
50
|
const legendValue = checked === true ? {
|
|
@@ -93,17 +88,49 @@ function LegendOptionsEditor({ value, onChange, showValuesEditor = true }) {
|
|
|
93
88
|
const legendModeConfig = _model.LEGEND_MODE_CONFIG[currentMode];
|
|
94
89
|
const currentSize = (0, _core.getLegendSize)(value?.size);
|
|
95
90
|
const legendSizeConfig = _model.LEGEND_SIZE_CONFIG[currentSize];
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
91
|
+
const legendValuesConfig = (0, _react.useMemo)(()=>{
|
|
92
|
+
const currentValues = value?.values;
|
|
93
|
+
if (!currentValues?.length) return [];
|
|
94
|
+
if (calculation === 'aggregation') {
|
|
95
|
+
return currentValues.reduce((result, item)=>{
|
|
96
|
+
const config = _model.LEGEND_VALUE_CONFIG[item];
|
|
97
|
+
if (config) {
|
|
98
|
+
result.push({
|
|
99
|
+
...config,
|
|
100
|
+
id: item
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}, []);
|
|
105
|
+
}
|
|
106
|
+
return currentValues.map((id)=>{
|
|
107
|
+
const { label, description } = _model.comparisonLegends[id];
|
|
108
|
+
return {
|
|
109
|
+
id,
|
|
110
|
+
label,
|
|
111
|
+
description
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}, [
|
|
115
|
+
calculation,
|
|
116
|
+
value?.values
|
|
117
|
+
]);
|
|
118
|
+
const valueOptions = (0, _react.useMemo)(()=>{
|
|
119
|
+
if (calculation === 'aggregation') {
|
|
120
|
+
return Object.entries(_model.LEGEND_VALUE_CONFIG || {}).map(([id, config])=>{
|
|
121
|
+
return {
|
|
122
|
+
id: id,
|
|
123
|
+
...config
|
|
124
|
+
};
|
|
103
125
|
});
|
|
104
126
|
}
|
|
105
|
-
return
|
|
106
|
-
|
|
127
|
+
return Object.entries(_model.comparisonLegends).map(([id, config])=>({
|
|
128
|
+
id: id,
|
|
129
|
+
...config
|
|
130
|
+
}));
|
|
131
|
+
}, [
|
|
132
|
+
calculation
|
|
133
|
+
]);
|
|
107
134
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_components.OptionsEditorGroup, {
|
|
108
135
|
title: "Legend",
|
|
109
136
|
children: [
|
|
@@ -116,7 +143,7 @@ function LegendOptionsEditor({ value, onChange, showValuesEditor = true }) {
|
|
|
116
143
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_components.OptionsEditorControl, {
|
|
117
144
|
label: "Show",
|
|
118
145
|
control: /*#__PURE__*/ (0, _jsxruntime.jsx)(_material.Switch, {
|
|
119
|
-
checked: value
|
|
146
|
+
checked: !!value,
|
|
120
147
|
onChange: handleLegendShowChange
|
|
121
148
|
})
|
|
122
149
|
}),
|
|
@@ -142,7 +169,7 @@ function LegendOptionsEditor({ value, onChange, showValuesEditor = true }) {
|
|
|
142
169
|
},
|
|
143
170
|
options: MODE_OPTIONS,
|
|
144
171
|
onChange: handleLegendModeChange,
|
|
145
|
-
disabled: value
|
|
172
|
+
disabled: !value,
|
|
146
173
|
disableClearable: true
|
|
147
174
|
})
|
|
148
175
|
}),
|
|
@@ -157,7 +184,7 @@ function LegendOptionsEditor({ value, onChange, showValuesEditor = true }) {
|
|
|
157
184
|
onChange: handleLegendSizeChange,
|
|
158
185
|
// TODO: enable sizes for list mode when we normalize the layout of
|
|
159
186
|
// lists to more closely match tables.
|
|
160
|
-
disabled: value
|
|
187
|
+
disabled: !value || currentMode !== 'table',
|
|
161
188
|
disableClearable: true
|
|
162
189
|
})
|
|
163
190
|
}),
|
|
@@ -171,9 +198,9 @@ function LegendOptionsEditor({ value, onChange, showValuesEditor = true }) {
|
|
|
171
198
|
disableCloseOnSelect: true,
|
|
172
199
|
disableClearable: true,
|
|
173
200
|
value: legendValuesConfig,
|
|
174
|
-
options:
|
|
201
|
+
options: valueOptions,
|
|
175
202
|
onChange: handleLegendValueChange,
|
|
176
|
-
disabled: value
|
|
203
|
+
disabled: !value || currentMode !== 'table',
|
|
177
204
|
limitTags: 1,
|
|
178
205
|
ChipProps: {
|
|
179
206
|
size: 'small'
|
package/dist/cjs/model/legend.js
CHANGED
|
@@ -33,6 +33,9 @@ _export(exports, {
|
|
|
33
33
|
LEGEND_VALUE_CONFIG: function() {
|
|
34
34
|
return LEGEND_VALUE_CONFIG;
|
|
35
35
|
},
|
|
36
|
+
comparisonLegends: function() {
|
|
37
|
+
return comparisonLegends;
|
|
38
|
+
},
|
|
36
39
|
legendValues: function() {
|
|
37
40
|
return legendValues;
|
|
38
41
|
},
|
|
@@ -51,6 +54,16 @@ const legendValues = [
|
|
|
51
54
|
'max',
|
|
52
55
|
'sum'
|
|
53
56
|
];
|
|
57
|
+
const comparisonLegends = {
|
|
58
|
+
abs: {
|
|
59
|
+
label: 'Absolute',
|
|
60
|
+
description: 'Absolute value'
|
|
61
|
+
},
|
|
62
|
+
relative: {
|
|
63
|
+
label: 'Relative',
|
|
64
|
+
description: 'Relative value'
|
|
65
|
+
}
|
|
66
|
+
};
|
|
54
67
|
const LEGEND_POSITIONS_CONFIG = {
|
|
55
68
|
bottom: {
|
|
56
69
|
label: 'Bottom'
|
|
@@ -83,7 +83,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
83
83
|
let instance = null;
|
|
84
84
|
const getPluginRuntime = ()=>{
|
|
85
85
|
if (instance === null) {
|
|
86
|
-
const pluginRuntime = (0, _runtime.
|
|
86
|
+
const pluginRuntime = (0, _runtime.createInstance)({
|
|
87
87
|
name: '@perses/perses-ui-host',
|
|
88
88
|
remotes: [],
|
|
89
89
|
shared: {
|
|
@@ -271,7 +271,8 @@ const registerRemote = (name, baseURL)=>{
|
|
|
271
271
|
};
|
|
272
272
|
const loadPlugin = async (moduleName, pluginName, baseURL)=>{
|
|
273
273
|
registerRemote(moduleName, baseURL);
|
|
274
|
-
|
|
274
|
+
const pluginRuntime = getPluginRuntime();
|
|
275
|
+
return pluginRuntime.loadRemote(`${moduleName}/${pluginName}`);
|
|
275
276
|
};
|
|
276
277
|
function usePluginRuntime({ plugin }) {
|
|
277
278
|
return {
|
|
@@ -4,6 +4,7 @@ export interface LegendOptionsEditorProps {
|
|
|
4
4
|
value?: LegendSpecOptions;
|
|
5
5
|
onChange: (legend?: LegendSpecOptions) => void;
|
|
6
6
|
showValuesEditor?: boolean;
|
|
7
|
+
calculation?: 'aggregation' | 'comparison';
|
|
7
8
|
}
|
|
8
|
-
export declare function LegendOptionsEditor({ value, onChange, showValuesEditor, }: LegendOptionsEditorProps): ReactElement;
|
|
9
|
+
export declare function LegendOptionsEditor({ value, onChange, showValuesEditor, calculation, }: LegendOptionsEditorProps): ReactElement;
|
|
9
10
|
//# sourceMappingURL=LegendOptionsEditor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendOptionsEditor.d.ts","sourceRoot":"","sources":["../../../src/components/LegendOptionsEditor/LegendOptionsEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"LegendOptionsEditor.d.ts","sourceRoot":"","sources":["../../../src/components/LegendOptionsEditor/LegendOptionsEditor.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAGL,iBAAiB,EAQlB,MAAM,aAAa,CAAC;AA+BrB,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC/C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,aAAa,GAAG,YAAY,CAAC;CAC5C;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,QAAQ,EACR,gBAAuB,EACvB,WAA2B,GAC5B,EAAE,wBAAwB,GAAG,YAAY,CAsKzC"}
|
|
@@ -14,7 +14,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
import { Switch } from '@mui/material';
|
|
15
15
|
import { DEFAULT_LEGEND, getLegendMode, getLegendPosition, getLegendSize } from '@perses-dev/core';
|
|
16
16
|
import { ErrorAlert, OptionsEditorControl, OptionsEditorGroup, SettingsAutocomplete } from '@perses-dev/components';
|
|
17
|
-
import {
|
|
17
|
+
import { useMemo } from 'react';
|
|
18
|
+
import { LEGEND_MODE_CONFIG, LEGEND_POSITIONS_CONFIG, validateLegendSpec, LEGEND_VALUE_CONFIG, LEGEND_SIZE_CONFIG, comparisonLegends } from '../../model';
|
|
18
19
|
const POSITION_OPTIONS = Object.entries(LEGEND_POSITIONS_CONFIG).map(([id, config])=>{
|
|
19
20
|
return {
|
|
20
21
|
id: id,
|
|
@@ -33,13 +34,7 @@ const SIZE_OPTIONS = Object.entries(LEGEND_SIZE_CONFIG).map(([id, config])=>{
|
|
|
33
34
|
...config
|
|
34
35
|
};
|
|
35
36
|
});
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
id: id,
|
|
39
|
-
...config
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
export function LegendOptionsEditor({ value, onChange, showValuesEditor = true }) {
|
|
37
|
+
export function LegendOptionsEditor({ value, onChange, showValuesEditor = true, calculation = 'aggregation' }) {
|
|
43
38
|
const handleLegendShowChange = (_, checked)=>{
|
|
44
39
|
// legend is hidden when legend obj is undefined
|
|
45
40
|
const legendValue = checked === true ? {
|
|
@@ -83,17 +78,49 @@ export function LegendOptionsEditor({ value, onChange, showValuesEditor = true }
|
|
|
83
78
|
const legendModeConfig = LEGEND_MODE_CONFIG[currentMode];
|
|
84
79
|
const currentSize = getLegendSize(value?.size);
|
|
85
80
|
const legendSizeConfig = LEGEND_SIZE_CONFIG[currentSize];
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
const legendValuesConfig = useMemo(()=>{
|
|
82
|
+
const currentValues = value?.values;
|
|
83
|
+
if (!currentValues?.length) return [];
|
|
84
|
+
if (calculation === 'aggregation') {
|
|
85
|
+
return currentValues.reduce((result, item)=>{
|
|
86
|
+
const config = LEGEND_VALUE_CONFIG[item];
|
|
87
|
+
if (config) {
|
|
88
|
+
result.push({
|
|
89
|
+
...config,
|
|
90
|
+
id: item
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}, []);
|
|
95
|
+
}
|
|
96
|
+
return currentValues.map((id)=>{
|
|
97
|
+
const { label, description } = comparisonLegends[id];
|
|
98
|
+
return {
|
|
99
|
+
id,
|
|
100
|
+
label,
|
|
101
|
+
description
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}, [
|
|
105
|
+
calculation,
|
|
106
|
+
value?.values
|
|
107
|
+
]);
|
|
108
|
+
const valueOptions = useMemo(()=>{
|
|
109
|
+
if (calculation === 'aggregation') {
|
|
110
|
+
return Object.entries(LEGEND_VALUE_CONFIG || {}).map(([id, config])=>{
|
|
111
|
+
return {
|
|
112
|
+
id: id,
|
|
113
|
+
...config
|
|
114
|
+
};
|
|
93
115
|
});
|
|
94
116
|
}
|
|
95
|
-
return
|
|
96
|
-
|
|
117
|
+
return Object.entries(comparisonLegends).map(([id, config])=>({
|
|
118
|
+
id: id,
|
|
119
|
+
...config
|
|
120
|
+
}));
|
|
121
|
+
}, [
|
|
122
|
+
calculation
|
|
123
|
+
]);
|
|
97
124
|
return /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
|
|
98
125
|
title: "Legend",
|
|
99
126
|
children: [
|
|
@@ -106,7 +133,7 @@ export function LegendOptionsEditor({ value, onChange, showValuesEditor = true }
|
|
|
106
133
|
/*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
107
134
|
label: "Show",
|
|
108
135
|
control: /*#__PURE__*/ _jsx(Switch, {
|
|
109
|
-
checked: value
|
|
136
|
+
checked: !!value,
|
|
110
137
|
onChange: handleLegendShowChange
|
|
111
138
|
})
|
|
112
139
|
}),
|
|
@@ -132,7 +159,7 @@ export function LegendOptionsEditor({ value, onChange, showValuesEditor = true }
|
|
|
132
159
|
},
|
|
133
160
|
options: MODE_OPTIONS,
|
|
134
161
|
onChange: handleLegendModeChange,
|
|
135
|
-
disabled: value
|
|
162
|
+
disabled: !value,
|
|
136
163
|
disableClearable: true
|
|
137
164
|
})
|
|
138
165
|
}),
|
|
@@ -147,7 +174,7 @@ export function LegendOptionsEditor({ value, onChange, showValuesEditor = true }
|
|
|
147
174
|
onChange: handleLegendSizeChange,
|
|
148
175
|
// TODO: enable sizes for list mode when we normalize the layout of
|
|
149
176
|
// lists to more closely match tables.
|
|
150
|
-
disabled: value
|
|
177
|
+
disabled: !value || currentMode !== 'table',
|
|
151
178
|
disableClearable: true
|
|
152
179
|
})
|
|
153
180
|
}),
|
|
@@ -161,9 +188,9 @@ export function LegendOptionsEditor({ value, onChange, showValuesEditor = true }
|
|
|
161
188
|
disableCloseOnSelect: true,
|
|
162
189
|
disableClearable: true,
|
|
163
190
|
value: legendValuesConfig,
|
|
164
|
-
options:
|
|
191
|
+
options: valueOptions,
|
|
165
192
|
onChange: handleLegendValueChange,
|
|
166
|
-
disabled: value
|
|
193
|
+
disabled: !value || currentMode !== 'table',
|
|
167
194
|
limitTags: 1,
|
|
168
195
|
ChipProps: {
|
|
169
196
|
size: 'small'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/LegendOptionsEditor/LegendOptionsEditor.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 { Switch, SwitchProps } from '@mui/material';\nimport { DEFAULT_LEGEND, getLegendMode, getLegendPosition, getLegendSize } from '@perses-dev/core';\nimport { ErrorAlert, OptionsEditorControl, OptionsEditorGroup, SettingsAutocomplete } from '@perses-dev/components';\nimport { ReactElement } from 'react';\nimport {\n LEGEND_MODE_CONFIG,\n LEGEND_POSITIONS_CONFIG,\n LegendSpecOptions,\n LegendSingleSelectConfig,\n validateLegendSpec,\n LEGEND_VALUE_CONFIG,\n LegendValue,\n LEGEND_SIZE_CONFIG,\n} from '../../model';\n\ntype LegendPositionOption = LegendSingleSelectConfig & { id: LegendSpecOptions['position'] };\n\nconst POSITION_OPTIONS: LegendPositionOption[] = Object.entries(LEGEND_POSITIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as LegendSpecOptions['position'],\n ...config,\n };\n});\n\ntype LegendModeOption = LegendSingleSelectConfig & { id: Required<LegendSpecOptions>['mode'] };\n\nconst MODE_OPTIONS: LegendModeOption[] = Object.entries(LEGEND_MODE_CONFIG).map(([id, config]) => {\n return {\n id: id as Required<LegendSpecOptions>['mode'],\n ...config,\n };\n});\n\ntype LegendSizeOption = LegendSingleSelectConfig & { id: Required<LegendSpecOptions>['size'] };\n\nconst SIZE_OPTIONS: LegendSizeOption[] = Object.entries(LEGEND_SIZE_CONFIG).map(([id, config]) => {\n return {\n id: id as Required<LegendSpecOptions>['size'],\n ...config,\n };\n});\n\ntype LegendValueOption = LegendSingleSelectConfig & { id: LegendValue };\nconst VALUE_OPTIONS: LegendValueOption[] = Object.entries(LEGEND_VALUE_CONFIG).map(([id, config]) => {\n return {\n id: id as LegendValue,\n ...config,\n };\n});\n\nexport interface LegendOptionsEditorProps {\n value?: LegendSpecOptions;\n onChange: (legend?: LegendSpecOptions) => void;\n showValuesEditor?: boolean;\n}\n\nexport function LegendOptionsEditor({\n value,\n onChange,\n showValuesEditor = true,\n}: LegendOptionsEditorProps): ReactElement {\n const handleLegendShowChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n // legend is hidden when legend obj is undefined\n const legendValue = checked === true ? { position: DEFAULT_LEGEND.position } : undefined;\n onChange(legendValue);\n };\n\n const handleLegendPositionChange = (_: unknown, newValue: LegendPositionOption): void => {\n onChange({\n ...value,\n position: newValue.id,\n });\n };\n\n const handleLegendModeChange = (_: unknown, newValue: LegendModeOption): void => {\n onChange({\n ...value,\n position: currentPosition,\n mode: newValue.id,\n });\n };\n\n const handleLegendSizeChange = (_: unknown, newValue: LegendSizeOption): void => {\n onChange({\n ...value,\n position: currentPosition,\n size: newValue.id,\n });\n };\n\n const handleLegendValueChange = (_: unknown, newValue: LegendValueOption[]): void => {\n onChange({\n ...value,\n position: currentPosition,\n values: newValue.map((value) => {\n return value.id;\n }),\n });\n };\n\n const isValidLegend = validateLegendSpec(value);\n const currentPosition = getLegendPosition(value?.position);\n const legendPositionConfig = LEGEND_POSITIONS_CONFIG[currentPosition];\n\n const currentMode = getLegendMode(value?.mode);\n const legendModeConfig = LEGEND_MODE_CONFIG[currentMode];\n\n const currentSize = getLegendSize(value?.size);\n const legendSizeConfig = LEGEND_SIZE_CONFIG[currentSize];\n\n const currentValues = value?.values || [];\n const legendValuesConfig = currentValues.reduce((result, item) => {\n const config = LEGEND_VALUE_CONFIG[item];\n if (config) {\n result.push({ ...config, id: item });\n }\n return result;\n }, [] as LegendValueOption[]);\n\n return (\n <OptionsEditorGroup title=\"Legend\">\n {!isValidLegend && <ErrorAlert error={{ name: 'invalid-legend', message: 'Invalid legend spec' }} />}\n <OptionsEditorControl\n label=\"Show\"\n control={<Switch checked={value !== undefined} onChange={handleLegendShowChange} />}\n />\n <OptionsEditorControl\n label=\"Position\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendPositionConfig,\n id: currentPosition,\n }}\n options={POSITION_OPTIONS}\n onChange={handleLegendPositionChange}\n disabled={value === undefined}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Mode\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendModeConfig,\n id: currentMode,\n }}\n options={MODE_OPTIONS}\n onChange={handleLegendModeChange}\n disabled={value === undefined}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Size\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendSizeConfig,\n id: currentSize,\n }}\n options={SIZE_OPTIONS}\n onChange={handleLegendSizeChange}\n // TODO: enable sizes for list mode when we normalize the layout of\n // lists to more closely match tables.\n disabled={value === undefined || currentMode !== 'table'}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n {showValuesEditor && (\n <OptionsEditorControl\n label=\"Values\"\n control={\n // For some reason, the inferred option type doesn't always seem to work\n // quite right when `multiple` is true. Explicitly setting the generics\n // to work around this.\n <SettingsAutocomplete<LegendValueOption, true, true>\n multiple={true}\n disableCloseOnSelect\n disableClearable\n value={legendValuesConfig}\n options={VALUE_OPTIONS}\n onChange={handleLegendValueChange}\n disabled={value === undefined || currentMode !== 'table'}\n limitTags={1}\n ChipProps={{\n size: 'small',\n }}\n />\n }\n />\n )}\n </OptionsEditorGroup>\n );\n}\n"],"names":["Switch","DEFAULT_LEGEND","getLegendMode","getLegendPosition","getLegendSize","ErrorAlert","OptionsEditorControl","OptionsEditorGroup","SettingsAutocomplete","LEGEND_MODE_CONFIG","LEGEND_POSITIONS_CONFIG","validateLegendSpec","LEGEND_VALUE_CONFIG","LEGEND_SIZE_CONFIG","POSITION_OPTIONS","Object","entries","map","id","config","MODE_OPTIONS","SIZE_OPTIONS","VALUE_OPTIONS","LegendOptionsEditor","value","onChange","showValuesEditor","handleLegendShowChange","_","checked","legendValue","position","undefined","handleLegendPositionChange","newValue","handleLegendModeChange","currentPosition","mode","handleLegendSizeChange","size","handleLegendValueChange","values","isValidLegend","legendPositionConfig","currentMode","legendModeConfig","currentSize","legendSizeConfig","currentValues","legendValuesConfig","reduce","result","item","push","title","error","name","message","label","control","options","disabled","disableClearable","multiple","disableCloseOnSelect","limitTags","ChipProps"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqB,gBAAgB;AACpD,SAASC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACnG,SAASC,UAAU,EAAEC,oBAAoB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,yBAAyB;AAEpH,SACEC,kBAAkB,EAClBC,uBAAuB,EAGvBC,kBAAkB,EAClBC,mBAAmB,EAEnBC,kBAAkB,QACb,cAAc;AAIrB,MAAMC,mBAA2CC,OAAOC,OAAO,CAACN,yBAAyBO,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IACxG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAIA,MAAMC,eAAmCL,OAAOC,OAAO,CAACP,oBAAoBQ,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IAC3F,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAIA,MAAME,eAAmCN,OAAOC,OAAO,CAACH,oBAAoBI,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IAC3F,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAGA,MAAMG,gBAAqCP,OAAOC,OAAO,CAACJ,qBAAqBK,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IAC9F,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX;AACF;AAQA,OAAO,SAASI,oBAAoB,EAClCC,KAAK,EACLC,QAAQ,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G,EAAE;IAEL,qBACE,MAAC5C;QAAmB+C,OAAM;;YACvB,CAACZ,+BAAiB,KAACrC;gBAAWkD,OAAO;oBAAEC,MAAM;oBAAkBC,SAAS;gBAAsB;;0BAC/F,KAACnD;gBACCoD,OAAM;gBACNC,uBAAS,KAAC3D;oBAAO6B,SAASL,UAAUQ;oBAAWP,UAAUE;;;0BAE3D,KAACrB;gBACCoD,OAAM;gBACNC,uBACE,KAACnD;oBACCgB,OAAO;wBACL,GAAGmB,oBAAoB;wBACvBzB,IAAIkB;oBACN;oBACAwB,SAAS9C;oBACTW,UAAUQ;oBACV4B,UAAUrC,UAAUQ;oBACpB8B,gBAAgB;;;0BAItB,KAACxD;gBACCoD,OAAM;gBACNC,uBACE,KAACnD;oBACCgB,OAAO;wBACL,GAAGqB,gBAAgB;wBACnB3B,IAAI0B;oBACN;oBACAgB,SAASxC;oBACTK,UAAUU;oBACV0B,UAAUrC,UAAUQ;oBACpB8B,gBAAgB;;;0BAItB,KAACxD;gBACCoD,OAAM;gBACNC,uBACE,KAACnD;oBACCgB,OAAO;wBACL,GAAGuB,gBAAgB;wBACnB7B,IAAI4B;oBACN;oBACAc,SAASvC;oBACTI,UAAUa;oBACV,mEAAmE;oBACnE,sCAAsC;oBACtCuB,UAAUrC,UAAUQ,aAAaY,gBAAgB;oBACjDkB,gBAAgB;;;YAIrBpC,kCACC,KAACpB;gBACCoD,OAAM;gBACNC,SACE,wEAAwE;gBACxE,uEAAuE;gBACvE,uBAAuB;8BACvB,KAACnD;oBACCuD,UAAU;oBACVC,oBAAoB;oBACpBF,gBAAgB;oBAChBtC,OAAOyB;oBACPW,SAAStC;oBACTG,UAAUe;oBACVqB,UAAUrC,UAAUQ,aAAaY,gBAAgB;oBACjDqB,WAAW;oBACXC,WAAW;wBACT3B,MAAM;oBACR;;;;;AAOd"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/LegendOptionsEditor/LegendOptionsEditor.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 { Switch, SwitchProps } from '@mui/material';\nimport { DEFAULT_LEGEND, getLegendMode, getLegendPosition, getLegendSize } from '@perses-dev/core';\nimport { ErrorAlert, OptionsEditorControl, OptionsEditorGroup, SettingsAutocomplete } from '@perses-dev/components';\nimport { ReactElement, useMemo } from 'react';\nimport {\n LEGEND_MODE_CONFIG,\n LEGEND_POSITIONS_CONFIG,\n LegendSpecOptions,\n LegendSingleSelectConfig,\n validateLegendSpec,\n LEGEND_VALUE_CONFIG,\n LegendValue,\n LEGEND_SIZE_CONFIG,\n comparisonLegends,\n ComparisonValues,\n} from '../../model';\n\ntype LegendPositionOption = LegendSingleSelectConfig & { id: LegendSpecOptions['position'] };\n\nconst POSITION_OPTIONS: LegendPositionOption[] = Object.entries(LEGEND_POSITIONS_CONFIG).map(([id, config]) => {\n return {\n id: id as LegendSpecOptions['position'],\n ...config,\n };\n});\n\ntype LegendModeOption = LegendSingleSelectConfig & { id: Required<LegendSpecOptions>['mode'] };\n\nconst MODE_OPTIONS: LegendModeOption[] = Object.entries(LEGEND_MODE_CONFIG).map(([id, config]) => {\n return {\n id: id as Required<LegendSpecOptions>['mode'],\n ...config,\n };\n});\n\ntype LegendSizeOption = LegendSingleSelectConfig & { id: Required<LegendSpecOptions>['size'] };\n\nconst SIZE_OPTIONS: LegendSizeOption[] = Object.entries(LEGEND_SIZE_CONFIG).map(([id, config]) => {\n return {\n id: id as Required<LegendSpecOptions>['size'],\n ...config,\n };\n});\n\ntype LegendValueOption = LegendSingleSelectConfig & { id: LegendValue | ComparisonValues };\n\nexport interface LegendOptionsEditorProps {\n value?: LegendSpecOptions;\n onChange: (legend?: LegendSpecOptions) => void;\n showValuesEditor?: boolean;\n calculation?: 'aggregation' | 'comparison';\n}\n\nexport function LegendOptionsEditor({\n value,\n onChange,\n showValuesEditor = true,\n calculation = 'aggregation',\n}: LegendOptionsEditorProps): ReactElement {\n const handleLegendShowChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n // legend is hidden when legend obj is undefined\n const legendValue = checked === true ? { position: DEFAULT_LEGEND.position } : undefined;\n onChange(legendValue);\n };\n\n const handleLegendPositionChange = (_: unknown, newValue: LegendPositionOption): void => {\n onChange({\n ...value,\n position: newValue.id,\n });\n };\n\n const handleLegendModeChange = (_: unknown, newValue: LegendModeOption): void => {\n onChange({\n ...value,\n position: currentPosition,\n mode: newValue.id,\n });\n };\n\n const handleLegendSizeChange = (_: unknown, newValue: LegendSizeOption): void => {\n onChange({\n ...value,\n position: currentPosition,\n size: newValue.id,\n });\n };\n\n const handleLegendValueChange = (_: unknown, newValue: LegendValueOption[]): void => {\n onChange({\n ...value,\n position: currentPosition,\n values: newValue.map((value) => {\n return value.id;\n }),\n });\n };\n\n const isValidLegend = validateLegendSpec(value);\n const currentPosition = getLegendPosition(value?.position);\n const legendPositionConfig = LEGEND_POSITIONS_CONFIG[currentPosition];\n\n const currentMode = getLegendMode(value?.mode);\n const legendModeConfig = LEGEND_MODE_CONFIG[currentMode];\n\n const currentSize = getLegendSize(value?.size);\n const legendSizeConfig = LEGEND_SIZE_CONFIG[currentSize];\n\n const legendValuesConfig = useMemo(() => {\n const currentValues = value?.values;\n if (!currentValues?.length) return [];\n\n if (calculation === 'aggregation') {\n return currentValues.reduce((result, item) => {\n const config = LEGEND_VALUE_CONFIG[item as LegendValue];\n if (config) {\n result.push({ ...config, id: item });\n }\n return result;\n }, [] as LegendValueOption[]);\n }\n\n return currentValues.map((id) => {\n const { label, description } = comparisonLegends[id as ComparisonValues];\n return {\n id,\n label,\n description,\n };\n });\n }, [calculation, value?.values]);\n\n const valueOptions = useMemo(() => {\n if (calculation === 'aggregation') {\n return Object.entries(LEGEND_VALUE_CONFIG || {}).map(([id, config]) => {\n return {\n id: id as LegendValue,\n ...config,\n };\n });\n }\n\n return Object.entries(comparisonLegends).map(([id, config]) => ({\n id: id as ComparisonValues,\n ...config,\n }));\n }, [calculation]);\n\n return (\n <OptionsEditorGroup title=\"Legend\">\n {!isValidLegend && <ErrorAlert error={{ name: 'invalid-legend', message: 'Invalid legend spec' }} />}\n <OptionsEditorControl label=\"Show\" control={<Switch checked={!!value} onChange={handleLegendShowChange} />} />\n <OptionsEditorControl\n label=\"Position\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendPositionConfig,\n id: currentPosition,\n }}\n options={POSITION_OPTIONS}\n onChange={handleLegendPositionChange}\n disabled={value === undefined}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Mode\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendModeConfig,\n id: currentMode,\n }}\n options={MODE_OPTIONS}\n onChange={handleLegendModeChange}\n disabled={!value}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n <OptionsEditorControl\n label=\"Size\"\n control={\n <SettingsAutocomplete\n value={{\n ...legendSizeConfig,\n id: currentSize,\n }}\n options={SIZE_OPTIONS}\n onChange={handleLegendSizeChange}\n // TODO: enable sizes for list mode when we normalize the layout of\n // lists to more closely match tables.\n disabled={!value || currentMode !== 'table'}\n disableClearable\n ></SettingsAutocomplete>\n }\n />\n {showValuesEditor && (\n <OptionsEditorControl\n label=\"Values\"\n control={\n // For some reason, the inferred option type doesn't always seem to work\n // quite right when `multiple` is true. Explicitly setting the generics\n // to work around this.\n <SettingsAutocomplete<LegendValueOption, true, true>\n multiple={true}\n disableCloseOnSelect\n disableClearable\n value={legendValuesConfig}\n options={valueOptions}\n onChange={handleLegendValueChange}\n disabled={!value || currentMode !== 'table'}\n limitTags={1}\n ChipProps={{\n size: 'small',\n }}\n />\n }\n />\n )}\n </OptionsEditorGroup>\n );\n}\n"],"names":["Switch","DEFAULT_LEGEND","getLegendMode","getLegendPosition","getLegendSize","ErrorAlert","OptionsEditorControl","OptionsEditorGroup","SettingsAutocomplete","useMemo","LEGEND_MODE_CONFIG","LEGEND_POSITIONS_CONFIG","validateLegendSpec","LEGEND_VALUE_CONFIG","LEGEND_SIZE_CONFIG","comparisonLegends","POSITION_OPTIONS","Object","entries","map","id","config","MODE_OPTIONS","SIZE_OPTIONS","LegendOptionsEditor","value","onChange","showValuesEditor","calculation","handleLegendShowChange","_","checked","legendValue","position","undefined","handleLegendPositionChange","newValue","handleLegendModeChange","currentPosition","mode","handleLegendSizeChange","size","handleLegendValueChange","values","isValidLegend","legendPositionConfig","currentMode","legendModeConfig","currentSize","legendSizeConfig","legendValuesConfig","currentValues","length","reduce","result","item","push","label","description","valueOptions","title","error","name","message","control","options","disabled","disableClearable","multiple","disableCloseOnSelect","limitTags","ChipProps"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqB,gBAAgB;AACpD,SAASC,cAAc,EAAEC,aAAa,EAAEC,iBAAiB,EAAEC,aAAa,QAAQ,mBAAmB;AACnG,SAASC,UAAU,EAAEC,oBAAoB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,yBAAyB;AACpH,SAAuBC,OAAO,QAAQ,QAAQ;AAC9C,SACEC,kBAAkB,EAClBC,uBAAuB,EAGvBC,kBAAkB,EAClBC,mBAAmB,EAEnBC,kBAAkB,EAClBC,iBAAiB,QAEZ,cAAc;AAIrB,MAAMC,mBAA2CC,OAAOC,OAAO,CAACP,yBAAyBQ,GAAG,CAAC,CAAC,CAACC,IAAIC,OAAO;IACxG,OAAO;QACLD,IAAIA;QACJ,GAAGC,MAAM;IACX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BAAO+B,SAAS,CAAC,CAACN;oBAAOC,UAAUG;;;0BAChF,KAACvB;gBACCmD,OAAM;gBACNO,uBACE,KAACxD;oBACCiB,OAAO;wBACL,GAAGoB,oBAAoB;wBACvBzB,IAAIkB;oBACN;oBACA2B,SAASjD;oBACTU,UAAUS;oBACV+B,UAAUzC,UAAUS;oBACpBiC,gBAAgB;;;0BAItB,KAAC7D;gBACCmD,OAAM;gBACNO,uBACE,KAACxD;oBACCiB,OAAO;wBACL,GAAGsB,gBAAgB;wBACnB3B,IAAI0B;oBACN;oBACAmB,SAAS3C;oBACTI,UAAUW;oBACV6B,UAAU,CAACzC;oBACX0C,gBAAgB;;;0BAItB,KAAC7D;gBACCmD,OAAM;gBACNO,uBACE,KAACxD;oBACCiB,OAAO;wBACL,GAAGwB,gBAAgB;wBACnB7B,IAAI4B;oBACN;oBACAiB,SAAS1C;oBACTG,UAAUc;oBACV,mEAAmE;oBACnE,sCAAsC;oBACtC0B,UAAU,CAACzC,SAASqB,gBAAgB;oBACpCqB,gBAAgB;;;YAIrBxC,kCACC,KAACrB;gBACCmD,OAAM;gBACNO,SACE,wEAAwE;gBACxE,uEAAuE;gBACvE,uBAAuB;8BACvB,KAACxD;oBACC4D,UAAU;oBACVC,oBAAoB;oBACpBF,gBAAgB;oBAChB1C,OAAOyB;oBACPe,SAASN;oBACTjC,UAAUgB;oBACVwB,UAAU,CAACzC,SAASqB,gBAAgB;oBACpCwB,WAAW;oBACXC,WAAW;wBACT9B,MAAM;oBACR;;;;;AAOd"}
|
package/dist/model/legend.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CalculationType, LegendMode, LegendOptionsBase, LegendPositions, LegendSize } from '@perses-dev/core';
|
|
2
2
|
export declare const legendValues: CalculationType[];
|
|
3
3
|
export type LegendValue = (typeof legendValues)[number];
|
|
4
|
+
export type ComparisonValues = 'abs' | 'relative';
|
|
5
|
+
export declare const comparisonLegends: Record<ComparisonValues, LegendSingleSelectConfig>;
|
|
4
6
|
export interface LegendSpecOptions extends LegendOptionsBase {
|
|
5
|
-
values?: LegendValue
|
|
7
|
+
values?: Array<LegendValue | ComparisonValues>;
|
|
6
8
|
}
|
|
7
9
|
export type LegendSingleSelectConfig = {
|
|
8
10
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,eAAe,EAGf,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAU1B,eAAO,MAAM,YAAY,EAAE,eAAe,EASzC,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,eAAe,EAGf,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAU1B,eAAO,MAAM,YAAY,EAAE,eAAe,EASzC,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,UAAU,CAAC;AAElD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,EAAE,wBAAwB,CAGhF,CAAC;AAKF,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,MAAM,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,gBAAgB,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,wBAAwB,CAAC,CAG/F,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAGrF,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAGrF,CAAC;AAEF,eAAO,MAAM,mBAAmB,+HAO/B,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAgBtE"}
|
package/dist/model/legend.js
CHANGED
|
@@ -28,6 +28,16 @@ export const legendValues = [
|
|
|
28
28
|
'max',
|
|
29
29
|
'sum'
|
|
30
30
|
];
|
|
31
|
+
export const comparisonLegends = {
|
|
32
|
+
abs: {
|
|
33
|
+
label: 'Absolute',
|
|
34
|
+
description: 'Absolute value'
|
|
35
|
+
},
|
|
36
|
+
relative: {
|
|
37
|
+
label: 'Relative',
|
|
38
|
+
description: 'Relative value'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
31
41
|
export const LEGEND_POSITIONS_CONFIG = {
|
|
32
42
|
bottom: {
|
|
33
43
|
label: 'Bottom'
|
package/dist/model/legend.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/legend.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 {\n CALCULATIONS_CONFIG,\n CalculationType,\n LegendMode,\n LegendOptionsBase,\n LegendPositions,\n isValidLegendMode,\n isValidLegendPosition,\n LegendSize,\n isValidLegendSize,\n} from '@perses-dev/core';\n\n// This file contains legend-related model code specific to panel plugin specs.\n// See the `core` package for common/shared legend model code and the\n// `components` package for legend model code specific to the Legend component.\n\n// Explicity listing the calculations we intend to use for legend values because\n// we want them ordered in a specific way, and it may be possible in the future\n// that we only use a subset of calculations for the legend because the calculations\n// are also used by other features.\nexport const legendValues: CalculationType[] = [\n 'mean',\n 'first',\n 'first-number',\n 'last',\n 'last-number',\n 'min',\n 'max',\n 'sum',\n];\nexport type LegendValue = (typeof legendValues)[number];\n\n// Note: explicitly defining different options for the legend spec and\n// legend component that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport interface LegendSpecOptions extends LegendOptionsBase {\n values?: LegendValue
|
|
1
|
+
{"version":3,"sources":["../../src/model/legend.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 {\n CALCULATIONS_CONFIG,\n CalculationType,\n LegendMode,\n LegendOptionsBase,\n LegendPositions,\n isValidLegendMode,\n isValidLegendPosition,\n LegendSize,\n isValidLegendSize,\n} from '@perses-dev/core';\n\n// This file contains legend-related model code specific to panel plugin specs.\n// See the `core` package for common/shared legend model code and the\n// `components` package for legend model code specific to the Legend component.\n\n// Explicity listing the calculations we intend to use for legend values because\n// we want them ordered in a specific way, and it may be possible in the future\n// that we only use a subset of calculations for the legend because the calculations\n// are also used by other features.\nexport const legendValues: CalculationType[] = [\n 'mean',\n 'first',\n 'first-number',\n 'last',\n 'last-number',\n 'min',\n 'max',\n 'sum',\n];\nexport type LegendValue = (typeof legendValues)[number];\n\nexport type ComparisonValues = 'abs' | 'relative';\n\nexport const comparisonLegends: Record<ComparisonValues, LegendSingleSelectConfig> = {\n abs: { label: 'Absolute', description: 'Absolute value' },\n relative: { label: 'Relative', description: 'Relative value' },\n};\n\n// Note: explicitly defining different options for the legend spec and\n// legend component that extend from some common options, so we can allow the\n// component and the spec to diverge in some upcoming work.\nexport interface LegendSpecOptions extends LegendOptionsBase {\n values?: Array<LegendValue | ComparisonValues>;\n}\n\nexport type LegendSingleSelectConfig = {\n label: string;\n description?: string;\n};\n\nexport const LEGEND_POSITIONS_CONFIG: Readonly<Record<LegendPositions, LegendSingleSelectConfig>> = {\n bottom: { label: 'Bottom' },\n right: { label: 'Right' },\n};\n\nexport const LEGEND_MODE_CONFIG: Readonly<Record<LegendMode, LegendSingleSelectConfig>> = {\n list: { label: 'List' },\n table: { label: 'Table' },\n};\n\nexport const LEGEND_SIZE_CONFIG: Readonly<Record<LegendSize, LegendSingleSelectConfig>> = {\n small: { label: 'Small' },\n medium: { label: 'Medium' },\n};\n\nexport const LEGEND_VALUE_CONFIG = legendValues.reduce(\n (config, value) => {\n config[value] = CALCULATIONS_CONFIG[value];\n\n return config;\n },\n {} as Partial<Record<LegendValue, LegendSingleSelectConfig>>\n);\n\nexport function validateLegendSpec(legend?: LegendOptionsBase): boolean {\n if (legend === undefined) {\n // undefined is valid since this is how legend is hidden by default\n return true;\n }\n if (!isValidLegendPosition(legend.position)) {\n return false;\n }\n if (legend.mode && !isValidLegendMode(legend.mode)) {\n return false;\n }\n if (legend.size && !isValidLegendSize(legend.size)) {\n return false;\n }\n\n return true;\n}\n"],"names":["CALCULATIONS_CONFIG","isValidLegendMode","isValidLegendPosition","isValidLegendSize","legendValues","comparisonLegends","abs","label","description","relative","LEGEND_POSITIONS_CONFIG","bottom","right","LEGEND_MODE_CONFIG","list","table","LEGEND_SIZE_CONFIG","small","medium","LEGEND_VALUE_CONFIG","reduce","config","value","validateLegendSpec","legend","undefined","position","mode","size"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE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AAG;QAClD,OAAO;IACT;IACA,IAAIH,OAAOI,IAAI,IAAI,CAACzB,kBAAkBqB,OAAOI,IAAI,GAAG;QAClD,OAAO;IACT;IAEA,OAAO;AACT"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleFederation } from '@module-federation/enhanced/runtime';
|
|
2
2
|
import { PersesPlugin, RemotePluginModule } from './PersesPlugin.types';
|
|
3
3
|
export declare const loadPlugin: (moduleName: string, pluginName: string, baseURL?: string) => Promise<RemotePluginModule | null>;
|
|
4
4
|
export declare function usePluginRuntime({ plugin }: {
|
|
5
5
|
plugin: PersesPlugin;
|
|
6
6
|
}): {
|
|
7
|
-
pluginRuntime:
|
|
7
|
+
pluginRuntime: ModuleFederation;
|
|
8
8
|
loadPlugin: () => Promise<RemotePluginModule | null>;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=PluginRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../src/remote/PluginRuntime.tsx"],"names":[],"mappings":"AAcA,OAAO,
|
|
1
|
+
{"version":3,"file":"PluginRuntime.d.ts","sourceRoot":"","sources":["../../src/remote/PluginRuntime.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAOvF,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAoMxE,eAAO,MAAM,UAAU,eACT,MAAM,cACN,MAAM,YACR,MAAM,KACf,QAAQ,kBAAkB,GAAG,IAAI,CAMnC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GAAG;IACtE,aAAa,EAAE,gBAAgB,CAAC;IAChC,UAAU,EAAE,MAAM,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;CACtD,CAKA"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
import {
|
|
13
|
+
import { createInstance } from '@module-federation/enhanced/runtime';
|
|
14
14
|
import * as ReactQuery from '@tanstack/react-query';
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import ReactDOM from 'react-dom';
|
|
@@ -19,7 +19,7 @@ import * as ReactRouterDOM from 'react-router-dom';
|
|
|
19
19
|
let instance = null;
|
|
20
20
|
const getPluginRuntime = ()=>{
|
|
21
21
|
if (instance === null) {
|
|
22
|
-
const pluginRuntime =
|
|
22
|
+
const pluginRuntime = createInstance({
|
|
23
23
|
name: '@perses/perses-ui-host',
|
|
24
24
|
remotes: [],
|
|
25
25
|
shared: {
|
|
@@ -207,7 +207,8 @@ const registerRemote = (name, baseURL)=>{
|
|
|
207
207
|
};
|
|
208
208
|
export const loadPlugin = async (moduleName, pluginName, baseURL)=>{
|
|
209
209
|
registerRemote(moduleName, baseURL);
|
|
210
|
-
|
|
210
|
+
const pluginRuntime = getPluginRuntime();
|
|
211
|
+
return pluginRuntime.loadRemote(`${moduleName}/${pluginName}`);
|
|
211
212
|
};
|
|
212
213
|
export function usePluginRuntime({ plugin }) {
|
|
213
214
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/remote/PluginRuntime.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-require-imports */\n// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { FederationHost, init, loadRemote } from '@module-federation/enhanced/runtime';\nimport * as ReactQuery from '@tanstack/react-query';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport * as ReactHookForm from 'react-hook-form';\nimport * as ReactRouterDOM from 'react-router-dom';\nimport { PersesPlugin, RemotePluginModule } from './PersesPlugin.types';\n\nlet instance: FederationHost | null = null;\n\nconst getPluginRuntime = (): FederationHost => {\n if (instance === null) {\n const pluginRuntime = init({\n name: '@perses/perses-ui-host',\n remotes: [], // all remotes are loaded dynamically\n shared: {\n react: {\n version: React.version,\n lib: () => React,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n 'react-dom': {\n version: '18.3.1',\n lib: () => ReactDOM,\n shareConfig: {\n singleton: true,\n requiredVersion: `^18.3.1`,\n },\n },\n 'react-router-dom': {\n version: '6.26.0',\n lib: () => ReactRouterDOM,\n shareConfig: {\n singleton: true,\n requiredVersion: '^6.26.0',\n },\n },\n '@tanstack/react-query': {\n version: '4.39.1',\n lib: () => ReactQuery,\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.39.1',\n },\n },\n 'react-hook-form': {\n version: '7.52.2',\n lib: () => ReactHookForm,\n shareConfig: {\n singleton: true,\n requiredVersion: '^7.52.2',\n },\n },\n echarts: {\n version: '5.5.0',\n lib: () => require('echarts'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^5.5.0',\n },\n },\n '@perses-dev/core': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/core'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/components': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/components'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/plugin-system': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/plugin-system'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/explore': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/explore'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/dashboards': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/dashboards'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n // Below are the shared modules that are used by the plugins, this can be part of the SDK\n 'date-fns': {\n version: '4.1.0',\n lib: () => require('date-fns'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.1.0',\n },\n },\n 'date-fns-tz': {\n version: '3.2.0',\n lib: () => require('date-fns-tz'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^3.2.0',\n },\n },\n lodash: {\n version: '4.17.21',\n lib: () => require('lodash'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.17.21',\n },\n },\n '@emotion/react': {\n version: '11.11.3',\n lib: () => require('@emotion/react'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^11.11.3',\n },\n },\n '@emotion/styled': {\n version: '11.11.0',\n lib: () => require('@emotion/styled'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^11.11.0',\n },\n },\n '@hookform/resolvers/zod': {\n version: '3.3.4',\n lib: () => require('@hookform/resolvers/zod'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^3.3.4',\n },\n },\n 'use-resize-observer': {\n version: '9.1.0',\n lib: () => require('use-resize-observer'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^9.1.0',\n },\n },\n 'mdi-material-ui': {\n version: '7.4.0',\n lib: () => require('mdi-material-ui'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^7.4.0',\n },\n },\n immer: {\n version: '10.1.1',\n lib: () => require('immer'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^10.1.1',\n },\n },\n },\n });\n\n instance = pluginRuntime;\n\n return instance;\n }\n return instance;\n};\n\nconst registerRemote = (name: string, baseURL?: string): void => {\n const pluginRuntime = getPluginRuntime();\n const existingRemote = pluginRuntime.options.remotes.find((remote) => remote.name === name);\n if (!existingRemote) {\n const remoteEntryURL = baseURL ? `${baseURL}/${name}/mf-manifest.json` : `/plugins/${name}/mf-manifest.json`;\n pluginRuntime.registerRemotes([\n {\n name,\n entry: remoteEntryURL,\n alias: name,\n },\n ]);\n }\n};\n\nexport const loadPlugin = async (\n moduleName: string,\n pluginName: string,\n baseURL?: string\n): Promise<RemotePluginModule | null> => {\n registerRemote(moduleName, baseURL);\n\n return loadRemote<RemotePluginModule>(`${moduleName}/${pluginName}`);\n};\n\nexport function usePluginRuntime({ plugin }: { plugin: PersesPlugin }): {\n pluginRuntime: FederationHost;\n loadPlugin: () => Promise<RemotePluginModule | null>;\n} {\n return {\n pluginRuntime: getPluginRuntime(),\n loadPlugin: () => loadPlugin(plugin.moduleName, plugin.name, plugin.baseURL),\n };\n}\n"],"names":["init","loadRemote","ReactQuery","React","ReactDOM","ReactHookForm","ReactRouterDOM","instance","getPluginRuntime","pluginRuntime","name","remotes","shared","react","version","lib","shareConfig","singleton","requiredVersion","echarts","require","lodash","immer","registerRemote","baseURL","existingRemote","options","find","remote","remoteEntryURL","registerRemotes","entry","alias","loadPlugin","moduleName","pluginName","usePluginRuntime","plugin"],"mappings":"AAAA,wDAAwD,GACxD,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAyBA,IAAI,EAAEC,UAAU,QAAQ,sCAAsC;AACvF,YAAYC,gBAAgB,wBAAwB;AACpD,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,cAAc,YAAY;AACjC,YAAYC,mBAAmB,kBAAkB;AACjD,YAAYC,oBAAoB,mBAAmB;AAGnD,IAAIC,WAAkC;AAEtC,MAAMC,mBAAmB;IACvB,IAAID,aAAa,MAAM;QACrB,MAAME,g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iB,CAACb,MAAcc;IACpC,MAAMf,gBAAgBD;IACtB,MAAMiB,iBAAiBhB,cAAciB,OAAO,CAACf,OAAO,CAACgB,IAAI,CAAC,CAACC,SAAWA,OAAOlB,IAAI,KAAKA;IACtF,IAAI,CAACe,gBAAgB;QACnB,MAAMI,iBAAiBL,UAAU,GAAGA,QAAQ,CAAC,EAAEd,KAAK,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAEA,KAAK,iBAAiB,CAAC;QAC5GD,cAAcqB,eAAe,CAAC;YAC5B;gBACEpB;gBACAqB,OAAOF;gBACPG,OAAOtB;YACT;SACD;IACH;AACF;AAEA,OAAO,MAAMuB,aAAa,OACxBC,YACAC,YACAX;IAEAD,eAAeW,YAAYV;IAE3B,OAAOvB,WAA+B,GAAGiC,WAAW,CAAC,EAAEC,YAAY;AACrE,EAAE;AAEF,OAAO,SAASC,iBAAiB,EAAEC,MAAM,EAA4B;IAInE,OAAO;QACL5B,eAAeD;QACfyB,YAAY,IAAMA,WAAWI,OAAOH,UAAU,EAAEG,OAAO3B,IAAI,EAAE2B,OAAOb,OAAO;IAC7E;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/remote/PluginRuntime.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-require-imports */\n// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createInstance, ModuleFederation } from '@module-federation/enhanced/runtime';\n\nimport * as ReactQuery from '@tanstack/react-query';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport * as ReactHookForm from 'react-hook-form';\nimport * as ReactRouterDOM from 'react-router-dom';\nimport { PersesPlugin, RemotePluginModule } from './PersesPlugin.types';\n\nlet instance: ModuleFederation | null = null;\n\nconst getPluginRuntime = (): ModuleFederation => {\n if (instance === null) {\n const pluginRuntime = createInstance({\n name: '@perses/perses-ui-host',\n remotes: [], // all remotes are loaded dynamically\n shared: {\n react: {\n version: React.version,\n lib: () => React,\n shareConfig: {\n singleton: true,\n requiredVersion: `^${React.version}`,\n },\n },\n 'react-dom': {\n version: '18.3.1',\n lib: () => ReactDOM,\n shareConfig: {\n singleton: true,\n requiredVersion: `^18.3.1`,\n },\n },\n 'react-router-dom': {\n version: '6.26.0',\n lib: () => ReactRouterDOM,\n shareConfig: {\n singleton: true,\n requiredVersion: '^6.26.0',\n },\n },\n '@tanstack/react-query': {\n version: '4.39.1',\n lib: () => ReactQuery,\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.39.1',\n },\n },\n 'react-hook-form': {\n version: '7.52.2',\n lib: () => ReactHookForm,\n shareConfig: {\n singleton: true,\n requiredVersion: '^7.52.2',\n },\n },\n echarts: {\n version: '5.5.0',\n lib: () => require('echarts'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^5.5.0',\n },\n },\n '@perses-dev/core': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/core'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/components': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/components'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/plugin-system': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/plugin-system'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/explore': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/explore'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n '@perses-dev/dashboards': {\n version: '0.51.0-rc.1',\n lib: () => require('@perses-dev/dashboards'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^0.51.0-rc.1',\n },\n },\n // Below are the shared modules that are used by the plugins, this can be part of the SDK\n 'date-fns': {\n version: '4.1.0',\n lib: () => require('date-fns'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.1.0',\n },\n },\n 'date-fns-tz': {\n version: '3.2.0',\n lib: () => require('date-fns-tz'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^3.2.0',\n },\n },\n lodash: {\n version: '4.17.21',\n lib: () => require('lodash'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^4.17.21',\n },\n },\n '@emotion/react': {\n version: '11.11.3',\n lib: () => require('@emotion/react'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^11.11.3',\n },\n },\n '@emotion/styled': {\n version: '11.11.0',\n lib: () => require('@emotion/styled'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^11.11.0',\n },\n },\n '@hookform/resolvers/zod': {\n version: '3.3.4',\n lib: () => require('@hookform/resolvers/zod'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^3.3.4',\n },\n },\n 'use-resize-observer': {\n version: '9.1.0',\n lib: () => require('use-resize-observer'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^9.1.0',\n },\n },\n 'mdi-material-ui': {\n version: '7.4.0',\n lib: () => require('mdi-material-ui'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^7.4.0',\n },\n },\n immer: {\n version: '10.1.1',\n lib: () => require('immer'),\n shareConfig: {\n singleton: true,\n requiredVersion: '^10.1.1',\n },\n },\n },\n });\n\n instance = pluginRuntime;\n\n return instance;\n }\n return instance;\n};\n\nconst registerRemote = (name: string, baseURL?: string): void => {\n const pluginRuntime = getPluginRuntime();\n const existingRemote = pluginRuntime.options.remotes.find((remote) => remote.name === name);\n if (!existingRemote) {\n const remoteEntryURL = baseURL ? `${baseURL}/${name}/mf-manifest.json` : `/plugins/${name}/mf-manifest.json`;\n pluginRuntime.registerRemotes([\n {\n name,\n entry: remoteEntryURL,\n alias: name,\n },\n ]);\n }\n};\n\nexport const loadPlugin = async (\n moduleName: string,\n pluginName: string,\n baseURL?: string\n): Promise<RemotePluginModule | null> => {\n registerRemote(moduleName, baseURL);\n\n const pluginRuntime = getPluginRuntime();\n\n return pluginRuntime.loadRemote<RemotePluginModule>(`${moduleName}/${pluginName}`);\n};\n\nexport function usePluginRuntime({ plugin }: { plugin: PersesPlugin }): {\n pluginRuntime: ModuleFederation;\n loadPlugin: () => Promise<RemotePluginModule | null>;\n} {\n return {\n pluginRuntime: getPluginRuntime(),\n loadPlugin: () => loadPlugin(plugin.moduleName, plugin.name, plugin.baseURL),\n };\n}\n"],"names":["createInstance","ReactQuery","React","ReactDOM","ReactHookForm","ReactRouterDOM","instance","getPluginRuntime","pluginRuntime","name","remotes","shared","react","version","lib","shareConfig","singleton","requiredVersion","echarts","require","lodash","immer","registerRemote","baseURL","existingRemote","options","find","remote","remoteEntryURL","registerRemotes","entry","alias","loadPlugin","moduleName","pluginName","loadRemote","usePluginRuntime","plugin"],"mappings":"AAAA,wDAAwD,GACxD,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,cAAc,QAA0B,sCAAsC;AAEvF,YAAYC,gBAAgB,wBAAwB;AACpD,OAAOC,WAAW,QAAQ;AAC1B,OAAOC,cAAc,YAAY;AACjC,YAAYC,mBAAmB,kBAAkB;AACjD,YAAYC,oBAAoB,mBAAmB;AAGnD,IAAIC,WAAoC;AAExC,MAAMC,mBAAmB;IACvB,IAAID,aAAa,MAAM;QACrB,MAAME,gBAAgBR,eAAe;YACnCS,MAAM;YACNC,SAAS,EAAE;YACXC,QAAQ;gBACNC,OAAO;oBACLC,SAASX,MAAMW,OAAO;oBACtBC,KAAK,IAAMZ;oBACXa,aAAa;wBAC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AAKA;IACtF,IAAI,CAACe,gBAAgB;QACnB,MAAMI,iBAAiBL,UAAU,GAAGA,QAAQ,CAAC,EAAEd,KAAK,iBAAiB,CAAC,GAAG,CAAC,SAAS,EAAEA,KAAK,iBAAiB,CAAC;QAC5GD,cAAcqB,eAAe,CAAC;YAC5B;gBACEpB;gBACAqB,OAAOF;gBACPG,OAAOtB;YACT;SACD;IACH;AACF;AAEA,OAAO,MAAMuB,aAAa,OACxBC,YACAC,YACAX;IAEAD,eAAeW,YAAYV;IAE3B,MAAMf,gBAAgBD;IAEtB,OAAOC,cAAc2B,UAAU,CAAqB,GAAGF,WAAW,CAAC,EAAEC,YAAY;AACnF,EAAE;AAEF,OAAO,SAASE,iBAAiB,EAAEC,MAAM,EAA4B;IAInE,OAAO;QACL7B,eAAeD;QACfyB,YAAY,IAAMA,WAAWK,OAAOJ,UAAU,EAAEI,OAAO5B,IAAI,EAAE4B,OAAOd,OAAO;IAC7E;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/plugin-system",
|
|
3
|
-
"version": "0.52.0-beta.
|
|
3
|
+
"version": "0.52.0-beta.3",
|
|
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",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"clean": "rimraf dist/",
|
|
20
20
|
"build": "concurrently \"npm:build:*\"",
|
|
21
|
-
"build:cjs": "swc ./src -d dist/cjs --config-file ../.cjs.swcrc",
|
|
22
|
-
"build:esm": "swc ./src -d dist --config-file ../.swcrc",
|
|
21
|
+
"build:cjs": "swc ./src -d dist/cjs --strip-leading-paths --config-file ../.cjs.swcrc",
|
|
22
|
+
"build:esm": "swc ./src -d dist --strip-leading-paths --config-file ../.swcrc",
|
|
23
23
|
"build:types": "tsc --project tsconfig.build.json",
|
|
24
24
|
"type-check": "tsc --noEmit",
|
|
25
25
|
"start": "concurrently -P \"npm:build:* -- {*}\" -- --watch",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@module-federation/enhanced": "^0.
|
|
32
|
-
"@perses-dev/components": "0.52.0-beta.
|
|
33
|
-
"@perses-dev/core": "0.52.0-beta.
|
|
31
|
+
"@module-federation/enhanced": "^0.18.0",
|
|
32
|
+
"@perses-dev/components": "0.52.0-beta.3",
|
|
33
|
+
"@perses-dev/core": "0.52.0-beta.3",
|
|
34
34
|
"date-fns": "^4.1.0",
|
|
35
35
|
"date-fns-tz": "^3.2.0",
|
|
36
36
|
"immer": "^10.1.1",
|