@grafana/scenes 8.18.1 → 8.18.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/CHANGELOG.md +24 -0
- package/dist/esm/components/VizPanel/VizPanelRenderer.js +6 -12
- package/dist/esm/components/VizPanel/VizPanelRenderer.js.map +1 -1
- package/dist/esm/components/layout/grid/SceneGridLayout.js +74 -27
- package/dist/esm/components/layout/grid/SceneGridLayout.js.map +1 -1
- package/dist/esm/core/events.js +4 -1
- package/dist/esm/core/events.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/locales/en-US/grafana-scenes.json.js +8 -0
- package/dist/esm/locales/en-US/grafana-scenes.json.js.map +1 -1
- package/dist/{grafana-scenes-Cb8bcz3V.js → grafana-scenes-CvG6Ol5c.js} +9 -1
- package/dist/{grafana-scenes-Cb8bcz3V.js.map → grafana-scenes-CvG6Ol5c.js.map} +1 -1
- package/dist/index.d.ts +18 -2
- package/dist/index.js +82 -39
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -35,6 +35,14 @@ var grafanaScenes = {
|
|
|
35
35
|
"group-by-key": "Group by {{keyLabel}}",
|
|
36
36
|
"remove-group-by-key": "Remove group by {{keyLabel}}"
|
|
37
37
|
},
|
|
38
|
+
layout: {
|
|
39
|
+
grid: {
|
|
40
|
+
"scene-grid-layout": {
|
|
41
|
+
"move-panel": "Move panel",
|
|
42
|
+
"resize-panel": "Resize panel"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
38
46
|
"nested-scene-renderer": {
|
|
39
47
|
"collapse-button-label": "Collapse scene",
|
|
40
48
|
"expand-button-label": "Expand scene",
|
|
@@ -198,4 +206,4 @@ var grafanaScenes = {
|
|
|
198
206
|
};
|
|
199
207
|
|
|
200
208
|
exports.default = grafanaScenes;
|
|
201
|
-
//# sourceMappingURL=grafana-scenes-
|
|
209
|
+
//# sourceMappingURL=grafana-scenes-CvG6Ol5c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grafana-scenes-
|
|
1
|
+
{"version":3,"file":"grafana-scenes-CvG6Ol5c.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1789,6 +1789,19 @@ interface SceneObjectStateChangedPayload<TState extends SceneObjectState = Scene
|
|
|
1789
1789
|
declare class SceneObjectStateChangedEvent extends BusEventWithPayload<SceneObjectStateChangedPayload> {
|
|
1790
1790
|
static readonly type = "scene-object-state-change";
|
|
1791
1791
|
}
|
|
1792
|
+
interface StateCommittedPayload {
|
|
1793
|
+
source: SceneObject;
|
|
1794
|
+
description: string;
|
|
1795
|
+
replay: () => void;
|
|
1796
|
+
revert: () => void;
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Published by a SceneObject after it applies a discrete, user-driven change it wants to be
|
|
1800
|
+
* undoable after already committed to state
|
|
1801
|
+
*/
|
|
1802
|
+
declare class StateCommittedEvent extends BusEventWithPayload<StateCommittedPayload> {
|
|
1803
|
+
static readonly type = "scene-object-state-committed";
|
|
1804
|
+
}
|
|
1792
1805
|
type UserActionEventType = 'panel-description-shown' | 'panel-status-message-clicked' | 'panel-cancel-query-clicked' | 'panel-menu-shown';
|
|
1793
1806
|
interface UserActionEventPayload {
|
|
1794
1807
|
origin: SceneObject;
|
|
@@ -3504,11 +3517,14 @@ declare class SceneGridLayout extends SceneObjectBase<SceneGridLayoutState> impl
|
|
|
3504
3517
|
toggleRow(row: SceneGridRow): void;
|
|
3505
3518
|
ignoreLayoutChange(shouldIgnore: boolean): void;
|
|
3506
3519
|
onLayoutChange: (layout: ReactGridLayout.Layout[]) => void;
|
|
3520
|
+
private _applyLayout;
|
|
3521
|
+
private _captureLayout;
|
|
3507
3522
|
/**
|
|
3508
3523
|
* Will also scan row children and return child of the row
|
|
3509
3524
|
*/
|
|
3510
3525
|
getSceneLayoutChild(key: string): SceneGridItemLike;
|
|
3511
3526
|
onResizeStop: ReactGridLayout.ItemCallback;
|
|
3527
|
+
private _commitState;
|
|
3512
3528
|
private pushChildDown;
|
|
3513
3529
|
/**
|
|
3514
3530
|
* We assume the layout array is sorted according to y pos, and walk upwards until we find a row.
|
|
@@ -4163,5 +4179,5 @@ declare const sceneUtils: {
|
|
|
4163
4179
|
|
|
4164
4180
|
|
|
4165
4181
|
|
|
4166
|
-
export { AdHocFiltersComboboxRenderer, AdHocFiltersVariable, AdHocFiltersVariableController, ConstantVariable, ControlsLabel, CustomVariable, DataProviderProxy, DataSourceVariable, EmbeddedScene, FieldConfigBuilder, FieldConfigBuilders, FieldConfigOverridesBuilder, GRID_CELL_HEIGHT, GRID_COLUMN_COUNT, GROUP_BY_OPERATOR, GroupByVariable, IntervalVariable, LazyLoader, LocalValueVariable, MultiOrSingleValueSelect, MultiValueVariable, NestedScene, NewSceneObjectAddedEvent, OPERATORS, PATH_ID_SEPARATOR, PanelBuilders, PanelOptionsBuilders, QueryVariable, RuntimeDataSource, SafeSerializableSceneObject, SceneApp, SceneAppPage, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataTransformer, SceneDebugger, SceneFlexItem, SceneFlexLayout, SceneGridItem, SceneGridLayout, SceneGridLayoutDragStartEvent, SceneGridRow, SceneObjectBase, SceneObjectRef, SceneObjectRemovedEvent, SceneObjectStateChangedEvent, SceneObjectUrlSyncConfig, SceneQueryRunner, SceneReactObject, SceneRefreshPicker, SceneTimePicker, SceneTimeRange, SceneTimeRangeCompare, SceneTimeRangeTransformerBase, SceneTimeZoneOverride, SceneToolbarButton, SceneToolbarInput, SceneVariableSet, SceneVariableValueChangedEvent, ScopesVariable, SplitLayout, SwitchVariable, TestVariable, TextBoxVariable, UrlSyncContextProvider, UrlSyncManager, UserActionEvent, VariableDependencyConfig, VariableValueControl, VariableValueSelectWrapper, VariableValueSelectors, VizConfigBuilder, VizConfigBuilders, VizPanel, VizPanelBuilder, VizPanelExploreButton, VizPanelFitScope, VizPanelMenu, index$2 as behaviors, index as dataLayers, escapeUrlPipeDelimiters, formatRegistry, getClosest, getCompareSeriesRefId, getExploreURL, getQueriesForVariables, isCustomVariableValue, isDataLayer, isDataRequestEnricher, isFiltersRequestEnricher, isGroupByFilter, isSceneObject, isSystemTransformationsProvider, loadResources, index$1 as performanceUtils, registerQueryWithController, registerRuntimeDataSource, sceneGraph, sceneUtils, timeShiftAlignmentProcessor, useSceneApp, useSceneObjectState, useUrlSync, writePerformanceLog };
|
|
4167
|
-
export type { AdHocFilterInteractionHandler, AdHocFilterWithLabels, AdHocFiltersController, AdHocFiltersControllerState, CancelActivationHandler, ControlSourceRef, ControlsLayout, CustomFormatterVariable, CustomTransformOperator, CustomTransformerDefinition, CustomVariableValue, DataLayerFilter, DataRequestEnricher, DataSourceControlRef, DeepPartial, EmbeddedSceneState, ExtraQueryDataProcessor, ExtraQueryDescriptor, ExtraQueryProvider, FiltersRequestEnricher, FormatVariable, InterpolationFormatParameter, LazyLoaderMode, MacroVariableConstructor, MultiValueVariableState, OperatorDefinition, QueryRunnerState, ResolvedSystemTransformations, SceneActivationHandler, SceneAppDrilldownView, SceneAppPageLike, SceneAppPageState, SceneAppRoute, SceneComponent, SceneComponentProps, SceneDataLayerProvider, SceneDataLayerProviderState, SceneDataProvider, SceneDataProviderResult, SceneDataQuery, SceneDataState, SceneDataTransformerState, SceneDeactivationHandler, SceneFlexItemLike, SceneFlexItemPlacement, SceneFlexItemState, SceneGridItemLike, SceneGridItemStateLike, SceneLayout, SceneLayoutChildOptions, SceneLayoutState, SceneObject, SceneObjectState, SceneObjectStateChangedPayload, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, SceneQueryControllerEntry, SceneQueryControllerEntryType, SceneQueryControllerLike, SceneRefreshPickerState, SceneRouteMatch, SceneStateChangedHandler, SceneStatelessBehavior, SceneTimeRangeLike, SceneTimeRangeState, SceneUrlSyncOptions, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSetState, SceneVariableState, SceneVariables, SystemTransformation, SystemTransformationPosition, SystemTransformationsProvider, TransformationOrigin, UrlSyncManagerLike, UseStateHookOptions, ValidateAndUpdateResult, VariableCustomFormatterFn, VariableGetOptionsArgs, VariableValue, VariableValueOption, VariableValueOptionProperties, VariableValueSingle, VizConfig, VizPanelFitScopeProps, VizPanelState };
|
|
4182
|
+
export { AdHocFiltersComboboxRenderer, AdHocFiltersVariable, AdHocFiltersVariableController, ConstantVariable, ControlsLabel, CustomVariable, DataProviderProxy, DataSourceVariable, EmbeddedScene, FieldConfigBuilder, FieldConfigBuilders, FieldConfigOverridesBuilder, GRID_CELL_HEIGHT, GRID_COLUMN_COUNT, GROUP_BY_OPERATOR, GroupByVariable, IntervalVariable, LazyLoader, LocalValueVariable, MultiOrSingleValueSelect, MultiValueVariable, NestedScene, NewSceneObjectAddedEvent, OPERATORS, PATH_ID_SEPARATOR, PanelBuilders, PanelOptionsBuilders, QueryVariable, RuntimeDataSource, SafeSerializableSceneObject, SceneApp, SceneAppPage, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataTransformer, SceneDebugger, SceneFlexItem, SceneFlexLayout, SceneGridItem, SceneGridLayout, SceneGridLayoutDragStartEvent, SceneGridRow, SceneObjectBase, SceneObjectRef, SceneObjectRemovedEvent, SceneObjectStateChangedEvent, SceneObjectUrlSyncConfig, SceneQueryRunner, SceneReactObject, SceneRefreshPicker, SceneTimePicker, SceneTimeRange, SceneTimeRangeCompare, SceneTimeRangeTransformerBase, SceneTimeZoneOverride, SceneToolbarButton, SceneToolbarInput, SceneVariableSet, SceneVariableValueChangedEvent, ScopesVariable, SplitLayout, StateCommittedEvent, SwitchVariable, TestVariable, TextBoxVariable, UrlSyncContextProvider, UrlSyncManager, UserActionEvent, VariableDependencyConfig, VariableValueControl, VariableValueSelectWrapper, VariableValueSelectors, VizConfigBuilder, VizConfigBuilders, VizPanel, VizPanelBuilder, VizPanelExploreButton, VizPanelFitScope, VizPanelMenu, index$2 as behaviors, index as dataLayers, escapeUrlPipeDelimiters, formatRegistry, getClosest, getCompareSeriesRefId, getExploreURL, getQueriesForVariables, isCustomVariableValue, isDataLayer, isDataRequestEnricher, isFiltersRequestEnricher, isGroupByFilter, isSceneObject, isSystemTransformationsProvider, loadResources, index$1 as performanceUtils, registerQueryWithController, registerRuntimeDataSource, sceneGraph, sceneUtils, timeShiftAlignmentProcessor, useSceneApp, useSceneObjectState, useUrlSync, writePerformanceLog };
|
|
4183
|
+
export type { AdHocFilterInteractionHandler, AdHocFilterWithLabels, AdHocFiltersController, AdHocFiltersControllerState, CancelActivationHandler, ControlSourceRef, ControlsLayout, CustomFormatterVariable, CustomTransformOperator, CustomTransformerDefinition, CustomVariableValue, DataLayerFilter, DataRequestEnricher, DataSourceControlRef, DeepPartial, EmbeddedSceneState, ExtraQueryDataProcessor, ExtraQueryDescriptor, ExtraQueryProvider, FiltersRequestEnricher, FormatVariable, InterpolationFormatParameter, LazyLoaderMode, MacroVariableConstructor, MultiValueVariableState, OperatorDefinition, QueryRunnerState, ResolvedSystemTransformations, SceneActivationHandler, SceneAppDrilldownView, SceneAppPageLike, SceneAppPageState, SceneAppRoute, SceneComponent, SceneComponentProps, SceneDataLayerProvider, SceneDataLayerProviderState, SceneDataProvider, SceneDataProviderResult, SceneDataQuery, SceneDataState, SceneDataTransformerState, SceneDeactivationHandler, SceneFlexItemLike, SceneFlexItemPlacement, SceneFlexItemState, SceneGridItemLike, SceneGridItemStateLike, SceneLayout, SceneLayoutChildOptions, SceneLayoutState, SceneObject, SceneObjectState, SceneObjectStateChangedPayload, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, SceneQueryControllerEntry, SceneQueryControllerEntryType, SceneQueryControllerLike, SceneRefreshPickerState, SceneRouteMatch, SceneStateChangedHandler, SceneStatelessBehavior, SceneTimeRangeLike, SceneTimeRangeState, SceneUrlSyncOptions, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSetState, SceneVariableState, SceneVariables, StateCommittedPayload, SystemTransformation, SystemTransformationPosition, SystemTransformationsProvider, TransformationOrigin, UrlSyncManagerLike, UseStateHookOptions, ValidateAndUpdateResult, VariableCustomFormatterFn, VariableGetOptionsArgs, VariableValue, VariableValueOption, VariableValueOptionProperties, VariableValueSingle, VizConfig, VizPanelFitScopeProps, VizPanelState };
|
package/dist/index.js
CHANGED
|
@@ -133,6 +133,9 @@ function EmptyRenderer(_) {
|
|
|
133
133
|
class SceneObjectStateChangedEvent extends data.BusEventWithPayload {
|
|
134
134
|
}
|
|
135
135
|
SceneObjectStateChangedEvent.type = "scene-object-state-change";
|
|
136
|
+
class StateCommittedEvent extends data.BusEventWithPayload {
|
|
137
|
+
}
|
|
138
|
+
StateCommittedEvent.type = "scene-object-state-committed";
|
|
136
139
|
class UserActionEvent extends data.BusEventWithPayload {
|
|
137
140
|
}
|
|
138
141
|
UserActionEvent.type = "scene-object-user-action";
|
|
@@ -3799,14 +3802,13 @@ function VizPanelRenderer({ model }) {
|
|
|
3799
3802
|
const isReadyToRender = dataObject.isDataReadyToDisplay ? dataObject.isDataReadyToDisplay() : true;
|
|
3800
3803
|
const context = model.getPanelContext();
|
|
3801
3804
|
const showNewPanelErrorsUI = Boolean(context.onOpenInspector);
|
|
3802
|
-
const onInvestigateErrors = context.onInvestigateErrors;
|
|
3803
3805
|
const panelId = model.getLegacyPanelId();
|
|
3804
3806
|
const outdatedPluginError = i18n.t(
|
|
3805
3807
|
"grafana-scenes.components.viz-panel-renderer.outdated-plugin-error",
|
|
3806
3808
|
'An unexpected error occurred. Updating the "{{pluginName}}" plugin to the latest version may fix the problem.',
|
|
3807
3809
|
{ pluginName: plugin.meta.name }
|
|
3808
3810
|
);
|
|
3809
|
-
const panelChrome = /* @__PURE__ */ React__default.default.createElement(
|
|
3811
|
+
const panelChrome = /* @__PURE__ */ React__default.default.createElement(ui.PanelContextProvider, { value: context }, /* @__PURE__ */ React__default.default.createElement(
|
|
3810
3812
|
ui.PanelChrome,
|
|
3811
3813
|
{
|
|
3812
3814
|
title: titleInterpolated,
|
|
@@ -3815,12 +3817,7 @@ function VizPanelRenderer({ model }) {
|
|
|
3815
3817
|
loadingState: data$1.state,
|
|
3816
3818
|
statusMessage: getChromeStatusMessage(data$1, _pluginLoadError),
|
|
3817
3819
|
statusItems: showNewPanelErrorsUI ? getChromeStatusItems(data$1, _pluginLoadError) : void 0,
|
|
3818
|
-
statusMessageOnClick: () =>
|
|
3819
|
-
var _a2;
|
|
3820
|
-
model.onStatusMessageClick();
|
|
3821
|
-
(_a2 = context.onOpenInspector) == null ? void 0 : _a2.call(context);
|
|
3822
|
-
},
|
|
3823
|
-
onInvestigateErrors: showNewPanelErrorsUI ? onInvestigateErrors : void 0,
|
|
3820
|
+
statusMessageOnClick: () => model.onStatusMessageClick(),
|
|
3824
3821
|
width: width === 0 ? void 0 : width,
|
|
3825
3822
|
height: fitContent ? void 0 : height === 0 ? void 0 : height,
|
|
3826
3823
|
minHeight: fitContent ? fitMinHeight : void 0,
|
|
@@ -3858,7 +3855,7 @@ function VizPanelRenderer({ model }) {
|
|
|
3858
3855
|
title: plugin.meta.hasUpdate ? outdatedPluginError : void 0,
|
|
3859
3856
|
dependencies: [plugin, data$1]
|
|
3860
3857
|
},
|
|
3861
|
-
/* @__PURE__ */ React__default.default.createElement(data.PluginContextProvider, { meta: plugin.meta },
|
|
3858
|
+
/* @__PURE__ */ React__default.default.createElement(data.PluginContextProvider, { meta: plugin.meta }, isReadyToRender && /* @__PURE__ */ React__default.default.createElement(
|
|
3862
3859
|
PanelComponent,
|
|
3863
3860
|
{
|
|
3864
3861
|
id: panelId,
|
|
@@ -3879,10 +3876,10 @@ function VizPanelRenderer({ model }) {
|
|
|
3879
3876
|
onChangeTimeRange: model.onTimeRangeChange,
|
|
3880
3877
|
eventBus: context.eventBus
|
|
3881
3878
|
}
|
|
3882
|
-
))
|
|
3879
|
+
))
|
|
3883
3880
|
);
|
|
3884
3881
|
}
|
|
3885
|
-
);
|
|
3882
|
+
));
|
|
3886
3883
|
if (fitContent) {
|
|
3887
3884
|
return /* @__PURE__ */ React__default.default.createElement(
|
|
3888
3885
|
"div",
|
|
@@ -15946,28 +15943,23 @@ const _SceneGridLayout = class _SceneGridLayout extends SceneObjectBase {
|
|
|
15946
15943
|
layout = [...this._oldLayout];
|
|
15947
15944
|
this._loadOldLayout = false;
|
|
15948
15945
|
}
|
|
15949
|
-
|
|
15950
|
-
const child = this.getSceneLayoutChild(item.i);
|
|
15951
|
-
const nextSize = {
|
|
15952
|
-
x: item.x,
|
|
15953
|
-
y: item.y,
|
|
15954
|
-
width: item.w,
|
|
15955
|
-
height: item.h
|
|
15956
|
-
};
|
|
15957
|
-
if (!isItemSizeEqual(child.state, nextSize)) {
|
|
15958
|
-
child.setState({
|
|
15959
|
-
...nextSize
|
|
15960
|
-
});
|
|
15961
|
-
}
|
|
15962
|
-
}
|
|
15963
|
-
this.setState({ children: sortChildrenByPosition(this.state.children) });
|
|
15946
|
+
this._applyLayout(layout);
|
|
15964
15947
|
};
|
|
15965
|
-
this.onResizeStop = (
|
|
15966
|
-
const
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
|
|
15948
|
+
this.onResizeStop = (layout) => {
|
|
15949
|
+
const from = this._captureLayout(layout);
|
|
15950
|
+
const hasChanges = layout.some(
|
|
15951
|
+
(item, i) => item.x !== from[i].x || item.y !== from[i].y || item.w !== from[i].w || item.h !== from[i].h
|
|
15952
|
+
);
|
|
15953
|
+
if (!hasChanges) {
|
|
15954
|
+
return;
|
|
15955
|
+
}
|
|
15956
|
+
this._commitState({
|
|
15957
|
+
source: this,
|
|
15958
|
+
description: i18n.t("grafana-scenes.components.layout.grid.scene-grid-layout.resize-panel", "Resize panel"),
|
|
15959
|
+
replay: () => this._applyLayout(layout),
|
|
15960
|
+
revert: () => this._applyLayout(from)
|
|
15970
15961
|
});
|
|
15962
|
+
this._skipOnLayoutChange = true;
|
|
15971
15963
|
};
|
|
15972
15964
|
this.onDragStart = (gridLayout) => {
|
|
15973
15965
|
this._oldLayout = [...gridLayout];
|
|
@@ -15977,15 +15969,16 @@ const _SceneGridLayout = class _SceneGridLayout extends SceneObjectBase {
|
|
|
15977
15969
|
gridLayout = sortGridLayout(gridLayout);
|
|
15978
15970
|
const indexOfUpdatedItem = gridLayout.findIndex((item) => item.i === updatedItem.i);
|
|
15979
15971
|
let newParent = this.findGridItemSceneParent(gridLayout, indexOfUpdatedItem - 1);
|
|
15980
|
-
|
|
15972
|
+
const positionChanges = [];
|
|
15981
15973
|
for (let i = 0; i < gridLayout.length; i++) {
|
|
15982
15974
|
const gridItem = gridLayout[i];
|
|
15983
15975
|
const child = this.getSceneLayoutChild(gridItem.i);
|
|
15984
15976
|
const childSize = child.state;
|
|
15985
15977
|
if ((childSize == null ? void 0 : childSize.x) !== gridItem.x || (childSize == null ? void 0 : childSize.y) !== gridItem.y) {
|
|
15986
|
-
|
|
15987
|
-
|
|
15988
|
-
y:
|
|
15978
|
+
positionChanges.push({
|
|
15979
|
+
child,
|
|
15980
|
+
from: { x: childSize.x, y: childSize.y },
|
|
15981
|
+
to: { x: gridItem.x, y: gridItem.y }
|
|
15989
15982
|
});
|
|
15990
15983
|
}
|
|
15991
15984
|
}
|
|
@@ -15998,10 +15991,32 @@ const _SceneGridLayout = class _SceneGridLayout extends SceneObjectBase {
|
|
|
15998
15991
|
}
|
|
15999
15992
|
newParent = this;
|
|
16000
15993
|
}
|
|
16001
|
-
|
|
16002
|
-
|
|
15994
|
+
const isReparenting = newParent !== sceneChild.parent && !this._loadOldLayout;
|
|
15995
|
+
const prevChildren = this.state.children;
|
|
15996
|
+
if (this._loadOldLayout) {
|
|
15997
|
+
positionChanges.forEach(({ child, to }) => child.setState(to));
|
|
15998
|
+
const nextChildren = isReparenting ? this.moveChildTo(sceneChild, newParent) : prevChildren;
|
|
15999
|
+
this.setState({ children: sortChildrenByPosition(nextChildren) });
|
|
16000
|
+
this._skipOnLayoutChange = true;
|
|
16001
|
+
return;
|
|
16002
|
+
}
|
|
16003
|
+
if (positionChanges.length === 0 && !isReparenting) {
|
|
16004
|
+
this._skipOnLayoutChange = true;
|
|
16005
|
+
return;
|
|
16003
16006
|
}
|
|
16004
|
-
this.
|
|
16007
|
+
this._commitState({
|
|
16008
|
+
source: this,
|
|
16009
|
+
description: i18n.t("grafana-scenes.components.layout.grid.scene-grid-layout.move-panel", "Move panel"),
|
|
16010
|
+
replay: () => {
|
|
16011
|
+
positionChanges.forEach(({ child, to }) => child.setState(to));
|
|
16012
|
+
const nextChildren = isReparenting ? this.moveChildTo(sceneChild, newParent) : prevChildren;
|
|
16013
|
+
this.setState({ children: sortChildrenByPosition(nextChildren) });
|
|
16014
|
+
},
|
|
16015
|
+
revert: () => {
|
|
16016
|
+
positionChanges.forEach(({ child, from }) => child.setState(from));
|
|
16017
|
+
this.setState({ children: sortChildrenByPosition(prevChildren) });
|
|
16018
|
+
}
|
|
16019
|
+
});
|
|
16005
16020
|
this._skipOnLayoutChange = true;
|
|
16006
16021
|
};
|
|
16007
16022
|
}
|
|
@@ -16088,6 +16103,29 @@ const _SceneGridLayout = class _SceneGridLayout extends SceneObjectBase {
|
|
|
16088
16103
|
ignoreLayoutChange(shouldIgnore) {
|
|
16089
16104
|
this._skipOnLayoutChange = shouldIgnore;
|
|
16090
16105
|
}
|
|
16106
|
+
_applyLayout(layout) {
|
|
16107
|
+
for (const item of layout) {
|
|
16108
|
+
const child = this.getSceneLayoutChild(item.i);
|
|
16109
|
+
const nextSize = {
|
|
16110
|
+
x: item.x,
|
|
16111
|
+
y: item.y,
|
|
16112
|
+
width: item.w,
|
|
16113
|
+
height: item.h
|
|
16114
|
+
};
|
|
16115
|
+
if (!isItemSizeEqual(child.state, nextSize)) {
|
|
16116
|
+
child.setState({
|
|
16117
|
+
...nextSize
|
|
16118
|
+
});
|
|
16119
|
+
}
|
|
16120
|
+
}
|
|
16121
|
+
this.setState({ children: sortChildrenByPosition(this.state.children) });
|
|
16122
|
+
}
|
|
16123
|
+
_captureLayout(layout) {
|
|
16124
|
+
return layout.map((item) => {
|
|
16125
|
+
const { x, y, width, height } = this.getSceneLayoutChild(item.i).state;
|
|
16126
|
+
return { ...item, x, y, w: width, h: height };
|
|
16127
|
+
});
|
|
16128
|
+
}
|
|
16091
16129
|
/**
|
|
16092
16130
|
* Will also scan row children and return child of the row
|
|
16093
16131
|
*/
|
|
@@ -16106,6 +16144,10 @@ const _SceneGridLayout = class _SceneGridLayout extends SceneObjectBase {
|
|
|
16106
16144
|
}
|
|
16107
16145
|
throw new Error("Scene layout child not found for GridItem");
|
|
16108
16146
|
}
|
|
16147
|
+
_commitState(payload) {
|
|
16148
|
+
payload.replay();
|
|
16149
|
+
this.publishEvent(new StateCommittedEvent(payload), true);
|
|
16150
|
+
}
|
|
16109
16151
|
pushChildDown(child, amount) {
|
|
16110
16152
|
child.setState({
|
|
16111
16153
|
y: child.state.y + amount
|
|
@@ -19135,7 +19177,7 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
19135
19177
|
switch (path) {
|
|
19136
19178
|
case '../locales/cs-CZ/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-CI4Hd3Ir.js'); });
|
|
19137
19179
|
case '../locales/de-DE/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-x4udT7z_.js'); });
|
|
19138
|
-
case '../locales/en-US/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-
|
|
19180
|
+
case '../locales/en-US/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-CvG6Ol5c.js'); });
|
|
19139
19181
|
case '../locales/es-ES/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-Drcb844D.js'); });
|
|
19140
19182
|
case '../locales/fr-FR/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-34JjEvff.js'); });
|
|
19141
19183
|
case '../locales/hu-HU/grafana-scenes.json': return Promise.resolve().then(function () { return require('./grafana-scenes-kXk-X6BX.js'); });
|
|
@@ -19265,6 +19307,7 @@ exports.SceneVariableSet = SceneVariableSet;
|
|
|
19265
19307
|
exports.SceneVariableValueChangedEvent = SceneVariableValueChangedEvent;
|
|
19266
19308
|
exports.ScopesVariable = ScopesVariable;
|
|
19267
19309
|
exports.SplitLayout = SplitLayout;
|
|
19310
|
+
exports.StateCommittedEvent = StateCommittedEvent;
|
|
19268
19311
|
exports.SwitchVariable = SwitchVariable;
|
|
19269
19312
|
exports.TestVariable = TestVariable;
|
|
19270
19313
|
exports.TextBoxVariable = TextBoxVariable;
|