@grafana/scenes 0.0.1
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/LICENSE +661 -0
- package/README.md +26 -0
- package/dist/esm/components/NestedScene.js +119 -0
- package/dist/esm/components/NestedScene.js.map +1 -0
- package/dist/esm/components/Scene.js +39 -0
- package/dist/esm/components/Scene.js.map +1 -0
- package/dist/esm/components/SceneCanvasText.js +41 -0
- package/dist/esm/components/SceneCanvasText.js.map +1 -0
- package/dist/esm/components/SceneDragHandle.js +18 -0
- package/dist/esm/components/SceneDragHandle.js.map +1 -0
- package/dist/esm/components/ScenePanelRepeater.js +66 -0
- package/dist/esm/components/ScenePanelRepeater.js.map +1 -0
- package/dist/esm/components/SceneSubMenu.js +18 -0
- package/dist/esm/components/SceneSubMenu.js.map +1 -0
- package/dist/esm/components/SceneTimePicker.js +40 -0
- package/dist/esm/components/SceneTimePicker.js.map +1 -0
- package/dist/esm/components/SceneToolbarButton.js +28 -0
- package/dist/esm/components/SceneToolbarButton.js.map +1 -0
- package/dist/esm/components/VizPanel/VizPanel.js +105 -0
- package/dist/esm/components/VizPanel/VizPanel.js.map +1 -0
- package/dist/esm/components/VizPanel/VizPanelRenderer.js +76 -0
- package/dist/esm/components/VizPanel/VizPanelRenderer.js.map +1 -0
- package/dist/esm/components/layout/SceneFlexLayout.js +88 -0
- package/dist/esm/components/layout/SceneFlexLayout.js.map +1 -0
- package/dist/esm/components/layout/SceneGridLayout.js +288 -0
- package/dist/esm/components/layout/SceneGridLayout.js.map +1 -0
- package/dist/esm/components/layout/SceneGridRow.js +124 -0
- package/dist/esm/components/layout/SceneGridRow.js.map +1 -0
- package/dist/esm/components/layout/constants.js +7 -0
- package/dist/esm/components/layout/constants.js.map +1 -0
- package/dist/esm/core/SceneComponentWrapper.js +84 -0
- package/dist/esm/core/SceneComponentWrapper.js.map +1 -0
- package/dist/esm/core/SceneDataNode.js +7 -0
- package/dist/esm/core/SceneDataNode.js.map +1 -0
- package/dist/esm/core/SceneDataTransformer.js +51 -0
- package/dist/esm/core/SceneDataTransformer.js.map +1 -0
- package/dist/esm/core/SceneObjectBase.js +141 -0
- package/dist/esm/core/SceneObjectBase.js.map +1 -0
- package/dist/esm/core/SceneTimeRange.js +108 -0
- package/dist/esm/core/SceneTimeRange.js.map +1 -0
- package/dist/esm/core/events.js +8 -0
- package/dist/esm/core/events.js.map +1 -0
- package/dist/esm/core/sceneGraph.js +68 -0
- package/dist/esm/core/sceneGraph.js.map +1 -0
- package/dist/esm/core/types.js +6 -0
- package/dist/esm/core/types.js.map +1 -0
- package/dist/esm/core/utils.js +57 -0
- package/dist/esm/core/utils.js.map +1 -0
- package/dist/esm/index.js +33 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/querying/SceneQueryRunner.js +161 -0
- package/dist/esm/querying/SceneQueryRunner.js.map +1 -0
- package/dist/esm/services/SceneObjectUrlSyncConfig.js +18 -0
- package/dist/esm/services/SceneObjectUrlSyncConfig.js.map +1 -0
- package/dist/esm/services/UrlSyncManager.js +133 -0
- package/dist/esm/services/UrlSyncManager.js.map +1 -0
- package/dist/esm/utils/metricTree.js +53 -0
- package/dist/esm/utils/metricTree.js.map +1 -0
- package/dist/esm/variables/VariableDependencyConfig.js +86 -0
- package/dist/esm/variables/VariableDependencyConfig.js.map +1 -0
- package/dist/esm/variables/components/VariableValueSelect.js +58 -0
- package/dist/esm/variables/components/VariableValueSelect.js.map +1 -0
- package/dist/esm/variables/components/VariableValueSelectors.js +56 -0
- package/dist/esm/variables/components/VariableValueSelectors.js.map +1 -0
- package/dist/esm/variables/constants.js +6 -0
- package/dist/esm/variables/constants.js.map +1 -0
- package/dist/esm/variables/interpolation/ScopedVarsVariable.js +49 -0
- package/dist/esm/variables/interpolation/ScopedVarsVariable.js.map +1 -0
- package/dist/esm/variables/interpolation/defaults.js +17 -0
- package/dist/esm/variables/interpolation/defaults.js.map +1 -0
- package/dist/esm/variables/interpolation/formatRegistry.js +280 -0
- package/dist/esm/variables/interpolation/formatRegistry.js.map +1 -0
- package/dist/esm/variables/interpolation/sceneInterpolator.js +83 -0
- package/dist/esm/variables/interpolation/sceneInterpolator.js.map +1 -0
- package/dist/esm/variables/sets/SceneVariableSet.js +123 -0
- package/dist/esm/variables/sets/SceneVariableSet.js.map +1 -0
- package/dist/esm/variables/types.js +8 -0
- package/dist/esm/variables/types.js.map +1 -0
- package/dist/esm/variables/variants/ConstantVariable.js +33 -0
- package/dist/esm/variables/variants/ConstantVariable.js.map +1 -0
- package/dist/esm/variables/variants/CustomVariable.js +58 -0
- package/dist/esm/variables/variants/CustomVariable.js.map +1 -0
- package/dist/esm/variables/variants/DataSourceVariable.js +92 -0
- package/dist/esm/variables/variants/DataSourceVariable.js.map +1 -0
- package/dist/esm/variables/variants/MultiValueVariable.js +183 -0
- package/dist/esm/variables/variants/MultiValueVariable.js.map +1 -0
- package/dist/esm/variables/variants/TestVariable.js +81 -0
- package/dist/esm/variables/variants/TestVariable.js.map +1 -0
- package/dist/esm/variables/variants/query/QueryVariable.js +137 -0
- package/dist/esm/variables/variants/query/QueryVariable.js.map +1 -0
- package/dist/esm/variables/variants/query/createQueryVariableRunner.js +93 -0
- package/dist/esm/variables/variants/query/createQueryVariableRunner.js.map +1 -0
- package/dist/esm/variables/variants/query/guards.js +18 -0
- package/dist/esm/variables/variants/query/guards.js.map +1 -0
- package/dist/esm/variables/variants/query/toMetricFindValues.js +93 -0
- package/dist/esm/variables/variants/query/toMetricFindValues.js.map +1 -0
- package/dist/esm/variables/variants/query/utils.js +93 -0
- package/dist/esm/variables/variants/query/utils.js.map +1 -0
- package/dist/index.d.ts +796 -0
- package/dist/index.js +3356 -0
- package/dist/index.js.map +1 -0
- package/package.json +103 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,796 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Observable, Observer, Subscription, Unsubscribable } from 'rxjs';
|
|
4
|
+
import { BusEventWithPayload, PanelData, BusEvent, BusEventType, BusEventHandler, TimeZone, TimeRange, ScopedVars, DataTransformerConfig, DataSourceRef, DataQuery, Registry, RegistryItem, VariableRefresh, VariableSort, FieldConfigSource, PanelPlugin, AbsoluteTimeRange } from '@grafana/data';
|
|
5
|
+
import { VariableType, VariableHide, VariableModel } from '@grafana/schema';
|
|
6
|
+
import { IconName } from '@grafana/ui';
|
|
7
|
+
import ReactGridLayout from 'react-grid-layout';
|
|
8
|
+
|
|
9
|
+
interface SceneVariableState extends SceneObjectStatePlain {
|
|
10
|
+
type: VariableType;
|
|
11
|
+
name: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
hide?: VariableHide;
|
|
14
|
+
skipUrlSync?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
error?: any | null;
|
|
17
|
+
description?: string | null;
|
|
18
|
+
}
|
|
19
|
+
interface SceneVariable<TState extends SceneVariableState = SceneVariableState> extends SceneObject<TState> {
|
|
20
|
+
/**
|
|
21
|
+
* This function is called on activation or when a dependency changes.
|
|
22
|
+
*/
|
|
23
|
+
validateAndUpdate?(): Observable<ValidateAndUpdateResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Should return the value for the given field path
|
|
26
|
+
*/
|
|
27
|
+
getValue(fieldPath?: string): VariableValue | undefined | null;
|
|
28
|
+
/**
|
|
29
|
+
* Should return the value display text, used by the "text" formatter
|
|
30
|
+
* Example: ${podId:text}
|
|
31
|
+
* Useful for variables that have non user friendly values but friendly display text names.
|
|
32
|
+
*/
|
|
33
|
+
getValueText?(fieldPath?: string): string;
|
|
34
|
+
}
|
|
35
|
+
type VariableValue = VariableValueSingle | VariableValueSingle[];
|
|
36
|
+
type VariableValueSingle = string | boolean | number | VariableValueCustom;
|
|
37
|
+
/**
|
|
38
|
+
* This is for edge case values like the custom "allValue" that should not be escaped/formatted like other values.
|
|
39
|
+
* The custom all value usually contain wildcards that should not be escaped.
|
|
40
|
+
*/
|
|
41
|
+
interface VariableValueCustom {
|
|
42
|
+
isCustomValue: true;
|
|
43
|
+
toString(): string;
|
|
44
|
+
}
|
|
45
|
+
interface ValidateAndUpdateResult {
|
|
46
|
+
}
|
|
47
|
+
interface VariableValueOption {
|
|
48
|
+
label: string;
|
|
49
|
+
value: VariableValueSingle;
|
|
50
|
+
}
|
|
51
|
+
interface SceneVariableSetState extends SceneObjectStatePlain {
|
|
52
|
+
variables: SceneVariable[];
|
|
53
|
+
}
|
|
54
|
+
interface SceneVariables extends SceneObject<SceneVariableSetState> {
|
|
55
|
+
getByName(name: string): SceneVariable | undefined;
|
|
56
|
+
}
|
|
57
|
+
declare class SceneVariableValueChangedEvent extends BusEventWithPayload<SceneVariable> {
|
|
58
|
+
static type: string;
|
|
59
|
+
}
|
|
60
|
+
interface SceneVariableDependencyConfigLike {
|
|
61
|
+
/** Return all variable names this object depend on */
|
|
62
|
+
getNames(): Set<string>;
|
|
63
|
+
/** Used to check for dependency on a specific variable */
|
|
64
|
+
hasDependencyOn(name: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Will be called when any variable value has changed.
|
|
67
|
+
**/
|
|
68
|
+
variableValuesChanged(variables: Set<SceneVariable>): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface SceneObjectStatePlain {
|
|
72
|
+
key?: string;
|
|
73
|
+
$timeRange?: SceneTimeRangeLike;
|
|
74
|
+
$data?: SceneObject<SceneDataState>;
|
|
75
|
+
$editor?: SceneEditor;
|
|
76
|
+
$variables?: SceneVariables;
|
|
77
|
+
}
|
|
78
|
+
interface SceneLayoutChildState extends SceneObjectStatePlain {
|
|
79
|
+
placement?: SceneLayoutChildOptions;
|
|
80
|
+
}
|
|
81
|
+
type SceneObjectState = SceneObjectStatePlain | SceneLayoutState | SceneLayoutChildState;
|
|
82
|
+
interface SceneLayoutChildOptions {
|
|
83
|
+
width?: number | string;
|
|
84
|
+
height?: number | string;
|
|
85
|
+
xSizing?: 'fill' | 'content';
|
|
86
|
+
ySizing?: 'fill' | 'content';
|
|
87
|
+
x?: number;
|
|
88
|
+
y?: number;
|
|
89
|
+
minWidth?: number | string;
|
|
90
|
+
minHeight?: number | string;
|
|
91
|
+
isDraggable?: boolean;
|
|
92
|
+
isResizable?: boolean;
|
|
93
|
+
}
|
|
94
|
+
interface SceneComponentProps<T> {
|
|
95
|
+
model: T;
|
|
96
|
+
isEditing?: boolean;
|
|
97
|
+
}
|
|
98
|
+
type SceneComponent<TModel> = React.FunctionComponent<SceneComponentProps<TModel>>;
|
|
99
|
+
interface SceneDataState extends SceneObjectStatePlain {
|
|
100
|
+
data?: PanelData;
|
|
101
|
+
}
|
|
102
|
+
interface SceneObject<TState extends SceneObjectState = SceneObjectState> {
|
|
103
|
+
/** The current state */
|
|
104
|
+
readonly state: TState;
|
|
105
|
+
/** True when there is a React component mounted for this Object */
|
|
106
|
+
readonly isActive: boolean;
|
|
107
|
+
/** SceneObject parent */
|
|
108
|
+
readonly parent?: SceneObject;
|
|
109
|
+
/** This abtractions declares what variables the scene object depends on and how to handle when they change value. **/
|
|
110
|
+
readonly variableDependency?: SceneVariableDependencyConfigLike;
|
|
111
|
+
/** This abstraction declares URL sync dependencies of a scene object. **/
|
|
112
|
+
readonly urlSync?: SceneObjectUrlSyncHandler<TState>;
|
|
113
|
+
/** Subscribe to state changes */
|
|
114
|
+
subscribeToState(observer?: Partial<Observer<TState>>): Subscription;
|
|
115
|
+
/** Subscribe to a scene event */
|
|
116
|
+
subscribeToEvent<T extends BusEvent>(typeFilter: BusEventType<T>, handler: BusEventHandler<T>): Unsubscribable;
|
|
117
|
+
/** Publish an event and optionally bubble it up the scene */
|
|
118
|
+
publishEvent(event: BusEvent, bubble?: boolean): void;
|
|
119
|
+
/** Utility hook that wraps useObservable. Used by React components to subscribes to state changes */
|
|
120
|
+
useState(): TState;
|
|
121
|
+
/** How to modify state */
|
|
122
|
+
setState(state: Partial<TState>): void;
|
|
123
|
+
/** Called when the Component is mounted. A place to register event listeners add subscribe to state changes */
|
|
124
|
+
activate(): void;
|
|
125
|
+
/** Called when component unmounts. Unsubscribe and closes all subscriptions */
|
|
126
|
+
deactivate(): void;
|
|
127
|
+
/** Get the scene root */
|
|
128
|
+
getRoot(): SceneObject;
|
|
129
|
+
/** Returns a deep clone this object and all its children */
|
|
130
|
+
clone(state?: Partial<TState>): this;
|
|
131
|
+
/** A React component to use for rendering the object */
|
|
132
|
+
Component(props: SceneComponentProps<SceneObject<TState>>): React.ReactElement | null;
|
|
133
|
+
/** To be replaced by declarative method */
|
|
134
|
+
Editor(props: SceneComponentProps<SceneObject<TState>>): React.ReactElement | null;
|
|
135
|
+
/** Force a re-render, should only be needed when variable values change */
|
|
136
|
+
forceRender(): void;
|
|
137
|
+
}
|
|
138
|
+
type SceneLayoutChild = SceneObject<SceneLayoutChildState | SceneLayoutState>;
|
|
139
|
+
interface SceneLayoutState extends SceneLayoutChildState {
|
|
140
|
+
children: SceneLayoutChild[];
|
|
141
|
+
}
|
|
142
|
+
type SceneLayout<T extends SceneLayoutState = SceneLayoutState> = SceneObject<T>;
|
|
143
|
+
interface SceneEditorState extends SceneObjectStatePlain {
|
|
144
|
+
hoverObject?: SceneObjectRef;
|
|
145
|
+
selectedObject?: SceneObjectRef;
|
|
146
|
+
}
|
|
147
|
+
interface SceneEditor extends SceneObject<SceneEditorState> {
|
|
148
|
+
onMouseEnterObject(model: SceneObject): void;
|
|
149
|
+
onMouseLeaveObject(model: SceneObject): void;
|
|
150
|
+
onSelectObject(model: SceneObject): void;
|
|
151
|
+
getEditComponentWrapper(): React.ComponentType<SceneComponentEditWrapperProps>;
|
|
152
|
+
}
|
|
153
|
+
interface SceneComponentEditWrapperProps {
|
|
154
|
+
editor: SceneEditor;
|
|
155
|
+
model: SceneObject;
|
|
156
|
+
children: React.ReactNode;
|
|
157
|
+
}
|
|
158
|
+
interface SceneTimeRangeState extends SceneObjectStatePlain {
|
|
159
|
+
from: string;
|
|
160
|
+
to: string;
|
|
161
|
+
timeZone: TimeZone;
|
|
162
|
+
fiscalYearStartMonth?: number;
|
|
163
|
+
value: TimeRange;
|
|
164
|
+
}
|
|
165
|
+
interface SceneTimeRangeLike extends SceneObject<SceneTimeRangeState> {
|
|
166
|
+
onTimeRangeChange(timeRange: TimeRange): void;
|
|
167
|
+
onIntervalChanged(interval: string): void;
|
|
168
|
+
onRefresh(): void;
|
|
169
|
+
}
|
|
170
|
+
interface SceneObjectRef {
|
|
171
|
+
ref: SceneObject;
|
|
172
|
+
}
|
|
173
|
+
declare function isSceneObject(obj: any): obj is SceneObject;
|
|
174
|
+
interface SceneObjectWithUrlSync<TState> extends SceneObject {
|
|
175
|
+
getUrlState(state: TState): SceneObjectUrlValues;
|
|
176
|
+
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
177
|
+
}
|
|
178
|
+
interface SceneObjectUrlSyncHandler<TState> {
|
|
179
|
+
getKeys(): string[];
|
|
180
|
+
getUrlState(state: TState): SceneObjectUrlValues;
|
|
181
|
+
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
182
|
+
}
|
|
183
|
+
type SceneObjectUrlValue = string | string[] | undefined | null;
|
|
184
|
+
type SceneObjectUrlValues = Record<string, SceneObjectUrlValue>;
|
|
185
|
+
type DeepPartial<T> = {
|
|
186
|
+
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
interface SceneObjectStateChangedPayload {
|
|
190
|
+
prevState: SceneObjectState;
|
|
191
|
+
newState: SceneObjectState;
|
|
192
|
+
partialUpdate: Partial<SceneObjectState>;
|
|
193
|
+
changedObject: SceneObject;
|
|
194
|
+
}
|
|
195
|
+
declare class SceneObjectStateChangedEvent extends BusEventWithPayload<SceneObjectStateChangedPayload> {
|
|
196
|
+
static readonly type = "scene-object-state-change";
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
type CustomFormatterFn = (value: unknown, legacyVariableModel: Partial<VariableModel>, legacyDefaultFormatter?: CustomFormatterFn) => string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Get the closest node with variables
|
|
203
|
+
*/
|
|
204
|
+
declare function getVariables(sceneObject: SceneObject): SceneVariables;
|
|
205
|
+
/**
|
|
206
|
+
* Will walk up the scene object graph to the closest $data scene object
|
|
207
|
+
*/
|
|
208
|
+
declare function getData(sceneObject: SceneObject): SceneObject<SceneDataState>;
|
|
209
|
+
/**
|
|
210
|
+
* Will walk up the scene object graph to the closest $timeRange scene object
|
|
211
|
+
*/
|
|
212
|
+
declare function getTimeRange(sceneObject: SceneObject): SceneTimeRangeLike;
|
|
213
|
+
/**
|
|
214
|
+
* Will walk up the scene object graph to the closest $editor scene object
|
|
215
|
+
*/
|
|
216
|
+
declare function getSceneEditor(sceneObject: SceneObject): SceneEditor;
|
|
217
|
+
/**
|
|
218
|
+
* Will walk up the scene object graph to the closest $layout scene object
|
|
219
|
+
*/
|
|
220
|
+
declare function getLayout(scene: SceneObject): SceneObject<SceneLayoutState>;
|
|
221
|
+
/**
|
|
222
|
+
* Interpolates the given string using the current scene object as context. *
|
|
223
|
+
*/
|
|
224
|
+
declare function interpolate(sceneObject: SceneObject, value: string | undefined | null, scopedVars?: ScopedVars, format?: string | CustomFormatterFn): string;
|
|
225
|
+
declare const sceneGraph: {
|
|
226
|
+
getVariables: typeof getVariables;
|
|
227
|
+
getData: typeof getData;
|
|
228
|
+
getTimeRange: typeof getTimeRange;
|
|
229
|
+
getSceneEditor: typeof getSceneEditor;
|
|
230
|
+
getLayout: typeof getLayout;
|
|
231
|
+
interpolate: typeof interpolate;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
declare abstract class SceneObjectBase<TState extends SceneObjectState = SceneObjectState> implements SceneObject<TState> {
|
|
235
|
+
private _isActive;
|
|
236
|
+
private _subject;
|
|
237
|
+
private _state;
|
|
238
|
+
private _events;
|
|
239
|
+
/** Incremented in SceneComponentWrapper, useful for tests and rendering optimizations */
|
|
240
|
+
protected _renderCount: number;
|
|
241
|
+
protected _parent?: SceneObject;
|
|
242
|
+
protected _subs: Subscription;
|
|
243
|
+
protected _variableDependency: SceneVariableDependencyConfigLike | undefined;
|
|
244
|
+
protected _urlSync: SceneObjectUrlSyncHandler<TState> | undefined;
|
|
245
|
+
constructor(state: TState);
|
|
246
|
+
/** Current state */
|
|
247
|
+
get state(): TState;
|
|
248
|
+
/** True if currently being active (ie displayed for visual objects) */
|
|
249
|
+
get isActive(): boolean;
|
|
250
|
+
/** Returns the parent, undefined for root object */
|
|
251
|
+
get parent(): SceneObject | undefined;
|
|
252
|
+
/** Returns variable dependency config */
|
|
253
|
+
get variableDependency(): SceneVariableDependencyConfigLike | undefined;
|
|
254
|
+
/** Returns url sync config */
|
|
255
|
+
get urlSync(): SceneObjectUrlSyncHandler<TState> | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* Used in render functions when rendering a SceneObject.
|
|
258
|
+
* Wraps the component in an EditWrapper that handles edit mode
|
|
259
|
+
*/
|
|
260
|
+
get Component(): SceneComponent<this>;
|
|
261
|
+
/**
|
|
262
|
+
* Temporary solution, should be replaced by declarative options
|
|
263
|
+
*/
|
|
264
|
+
get Editor(): SceneComponent<this>;
|
|
265
|
+
private setParent;
|
|
266
|
+
/**
|
|
267
|
+
* Subscribe to the scene state subject
|
|
268
|
+
**/
|
|
269
|
+
subscribeToState(observerOrNext?: Partial<Observer<TState>>): Subscription;
|
|
270
|
+
/**
|
|
271
|
+
* Subscribe to the scene event
|
|
272
|
+
**/
|
|
273
|
+
subscribeToEvent<T extends BusEvent>(eventType: BusEventType<T>, handler: BusEventHandler<T>): Unsubscribable;
|
|
274
|
+
setState(update: Partial<TState>): void;
|
|
275
|
+
publishEvent(event: BusEvent, bubble?: boolean): void;
|
|
276
|
+
getRoot(): SceneObject;
|
|
277
|
+
/**
|
|
278
|
+
* Called by the SceneComponentWrapper when the react component is mounted
|
|
279
|
+
*/
|
|
280
|
+
activate(): void;
|
|
281
|
+
/**
|
|
282
|
+
* Called by the SceneComponentWrapper when the react component is unmounted
|
|
283
|
+
*/
|
|
284
|
+
deactivate(): void;
|
|
285
|
+
/**
|
|
286
|
+
* Utility hook to get and subscribe to state
|
|
287
|
+
*/
|
|
288
|
+
useState(): TState;
|
|
289
|
+
/** Force a re-render, should only be needed when variable values change */
|
|
290
|
+
forceRender(): void;
|
|
291
|
+
/**
|
|
292
|
+
* Will create new SceneObject with shallow-cloned state, but all state items of type SceneObject are deep cloned
|
|
293
|
+
*/
|
|
294
|
+
clone(withState?: Partial<TState>): this;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
interface SceneDataNodeState extends SceneObjectStatePlain {
|
|
298
|
+
data?: PanelData;
|
|
299
|
+
}
|
|
300
|
+
declare class SceneDataNode extends SceneObjectBase<SceneDataNodeState> {
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
interface SceneDataTransformerState extends SceneDataState {
|
|
304
|
+
transformations?: DataTransformerConfig[];
|
|
305
|
+
}
|
|
306
|
+
declare class SceneDataTransformer extends SceneObjectBase<SceneDataTransformerState> {
|
|
307
|
+
private _transformationsSub?;
|
|
308
|
+
activate(): void;
|
|
309
|
+
deactivate(): void;
|
|
310
|
+
private transformData;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
interface SceneObjectUrlSyncConfigOptions {
|
|
314
|
+
keys: string[];
|
|
315
|
+
}
|
|
316
|
+
declare class SceneObjectUrlSyncConfig<TState extends SceneObjectState> implements SceneObjectUrlSyncHandler<TState> {
|
|
317
|
+
private _sceneObject;
|
|
318
|
+
private _keys;
|
|
319
|
+
constructor(_sceneObject: SceneObjectWithUrlSync<TState>, _options: SceneObjectUrlSyncConfigOptions);
|
|
320
|
+
getKeys(): string[];
|
|
321
|
+
getUrlState(state: TState): SceneObjectUrlValues;
|
|
322
|
+
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
declare class SceneTimeRange extends SceneObjectBase<SceneTimeRangeState> implements SceneTimeRangeLike {
|
|
326
|
+
protected _urlSync: SceneObjectUrlSyncConfig<SceneTimeRangeState>;
|
|
327
|
+
constructor(state?: Partial<SceneTimeRangeState>);
|
|
328
|
+
onTimeRangeChange: (timeRange: TimeRange) => void;
|
|
329
|
+
onRefresh: () => void;
|
|
330
|
+
onIntervalChanged: (_: string) => void;
|
|
331
|
+
getUrlState(state: SceneTimeRangeState): {
|
|
332
|
+
from: string;
|
|
333
|
+
to: string;
|
|
334
|
+
};
|
|
335
|
+
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
interface VariableDependencyConfigOptions<TState extends SceneObjectState> {
|
|
339
|
+
/**
|
|
340
|
+
* State paths to scan / extract variable dependencies from. Leave empty to scan all paths.
|
|
341
|
+
*/
|
|
342
|
+
statePaths?: Array<keyof TState>;
|
|
343
|
+
/**
|
|
344
|
+
* Optional way to customize how to handle when a dependent variable changes
|
|
345
|
+
* If not specified the default behavior is to trigger a re-render
|
|
346
|
+
*/
|
|
347
|
+
onReferencedVariableValueChanged?: () => void;
|
|
348
|
+
}
|
|
349
|
+
declare class VariableDependencyConfig<TState extends SceneObjectState> implements SceneVariableDependencyConfigLike {
|
|
350
|
+
private _sceneObject;
|
|
351
|
+
private _state;
|
|
352
|
+
private _dependencies;
|
|
353
|
+
private _statePaths?;
|
|
354
|
+
private _onReferencedVariableValueChanged;
|
|
355
|
+
scanCount: number;
|
|
356
|
+
constructor(_sceneObject: SceneObject<TState>, options: VariableDependencyConfigOptions<TState>);
|
|
357
|
+
/**
|
|
358
|
+
* Used to check for dependency on a specific variable
|
|
359
|
+
*/
|
|
360
|
+
hasDependencyOn(name: string): boolean;
|
|
361
|
+
/**
|
|
362
|
+
* This is called whenever any set of variables have new values. It up to this implementation to check if it's relevant given the current dependencies.
|
|
363
|
+
*/
|
|
364
|
+
variableValuesChanged(variables: Set<SceneVariable>): void;
|
|
365
|
+
/**
|
|
366
|
+
* Only way to force a re-render is to update state right now
|
|
367
|
+
*/
|
|
368
|
+
private defaultHandlerReferencedVariableValueChanged;
|
|
369
|
+
getNames(): Set<string>;
|
|
370
|
+
private scanStateForDependencies;
|
|
371
|
+
private extractVariablesFrom;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
interface QueryRunnerState extends SceneObjectStatePlain {
|
|
375
|
+
data?: PanelData;
|
|
376
|
+
queries: DataQueryExtended[];
|
|
377
|
+
transformations?: DataTransformerConfig[];
|
|
378
|
+
datasource?: DataSourceRef;
|
|
379
|
+
minInterval?: string;
|
|
380
|
+
maxDataPoints?: number;
|
|
381
|
+
maxDataPointsFromWidth?: boolean;
|
|
382
|
+
}
|
|
383
|
+
interface DataQueryExtended extends DataQuery {
|
|
384
|
+
[key: string]: any;
|
|
385
|
+
}
|
|
386
|
+
declare class SceneQueryRunner extends SceneObjectBase<QueryRunnerState> {
|
|
387
|
+
private _querySub?;
|
|
388
|
+
private _containerWidth?;
|
|
389
|
+
protected _variableDependency: VariableDependencyConfig<QueryRunnerState>;
|
|
390
|
+
activate(): void;
|
|
391
|
+
private shouldRunQueriesOnActivate;
|
|
392
|
+
deactivate(): void;
|
|
393
|
+
setContainerWidth(width: number): void;
|
|
394
|
+
runQueries(): void;
|
|
395
|
+
private getMaxDataPoints;
|
|
396
|
+
private runWithTimeRange;
|
|
397
|
+
private onDataReceived;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
interface FormatRegistryItem extends RegistryItem {
|
|
401
|
+
formatter(value: VariableValue, args: string[], variable: FormatVariable): string;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Slimmed down version of the SceneVariable interface so that it only contains what the formatters actually use.
|
|
405
|
+
* This is useful as we have some implementations of this interface that does not need to be full scene objects.
|
|
406
|
+
* For example ScopedVarsVariable and LegacyVariableWrapper.
|
|
407
|
+
*/
|
|
408
|
+
interface FormatVariable {
|
|
409
|
+
state: {
|
|
410
|
+
name: string;
|
|
411
|
+
type: VariableType | string;
|
|
412
|
+
};
|
|
413
|
+
getValue(fieldPath?: string): VariableValue | undefined | null;
|
|
414
|
+
getValueText?(fieldPath?: string): string;
|
|
415
|
+
}
|
|
416
|
+
declare enum FormatRegistryID {
|
|
417
|
+
lucene = "lucene",
|
|
418
|
+
raw = "raw",
|
|
419
|
+
regex = "regex",
|
|
420
|
+
pipe = "pipe",
|
|
421
|
+
distributed = "distributed",
|
|
422
|
+
csv = "csv",
|
|
423
|
+
html = "html",
|
|
424
|
+
json = "json",
|
|
425
|
+
percentEncode = "percentencode",
|
|
426
|
+
singleQuote = "singlequote",
|
|
427
|
+
doubleQuote = "doublequote",
|
|
428
|
+
sqlString = "sqlstring",
|
|
429
|
+
date = "date",
|
|
430
|
+
glob = "glob",
|
|
431
|
+
text = "text",
|
|
432
|
+
queryParam = "queryparam"
|
|
433
|
+
}
|
|
434
|
+
declare const formatRegistry: Registry<FormatRegistryItem>;
|
|
435
|
+
|
|
436
|
+
declare class VariableValueSelectors extends SceneObjectBase<SceneObjectStatePlain> {
|
|
437
|
+
static Component: typeof VariableValueSelectorsRenderer;
|
|
438
|
+
}
|
|
439
|
+
declare function VariableValueSelectorsRenderer({ model }: SceneComponentProps<VariableValueSelectors>): JSX.Element;
|
|
440
|
+
|
|
441
|
+
declare class SceneVariableSet extends SceneObjectBase<SceneVariableSetState> implements SceneVariables {
|
|
442
|
+
/** Variables that have changed in since the activation or since the first manual value change */
|
|
443
|
+
private variablesThatHaveChanged;
|
|
444
|
+
/** Variables that are scheduled to be validated and updated */
|
|
445
|
+
private variablesToUpdate;
|
|
446
|
+
/** Variables currently updating */
|
|
447
|
+
private updating;
|
|
448
|
+
getByName(name: string): SceneVariable | undefined;
|
|
449
|
+
/**
|
|
450
|
+
* Subscribes to child variable value changes
|
|
451
|
+
* And starts the variable value validation process
|
|
452
|
+
*/
|
|
453
|
+
activate(): void;
|
|
454
|
+
/**
|
|
455
|
+
* Cancel all currently running updates
|
|
456
|
+
*/
|
|
457
|
+
deactivate(): void;
|
|
458
|
+
/**
|
|
459
|
+
* This loops through variablesToUpdate and update all that that can.
|
|
460
|
+
* If one has a dependency that is currently in variablesToUpdate it will be skipped for now.
|
|
461
|
+
*/
|
|
462
|
+
private updateNextBatch;
|
|
463
|
+
/**
|
|
464
|
+
* A variable has completed it's update process. This could mean that variables that depend on it can now be updated in turn.
|
|
465
|
+
*/
|
|
466
|
+
private validateAndUpdateCompleted;
|
|
467
|
+
/**
|
|
468
|
+
* TODO handle this properly (and show error in UI).
|
|
469
|
+
* Not sure if this should be handled here on in MultiValueVariable
|
|
470
|
+
*/
|
|
471
|
+
private handleVariableError;
|
|
472
|
+
/**
|
|
473
|
+
* Checks if the variable has any dependencies that is currently in variablesToUpdate
|
|
474
|
+
*/
|
|
475
|
+
private hasDependendencyInUpdateQueue;
|
|
476
|
+
/**
|
|
477
|
+
* Extract dependencies from all variables and add those that needs update to the variablesToUpdate map
|
|
478
|
+
* Then it will start the update process.
|
|
479
|
+
*/
|
|
480
|
+
private validateAndUpdateAll;
|
|
481
|
+
/**
|
|
482
|
+
* This will trigger an update of all variables that depend on it.
|
|
483
|
+
* */
|
|
484
|
+
private onVariableValueChanged;
|
|
485
|
+
/**
|
|
486
|
+
* Walk scene object graph and update all objects that depend on variables that have changed
|
|
487
|
+
*/
|
|
488
|
+
private notifyDependentSceneObjects;
|
|
489
|
+
/**
|
|
490
|
+
* Recursivly walk the full scene object graph and notify all objects with dependencies that include any of changed variables
|
|
491
|
+
*/
|
|
492
|
+
private traverseSceneAndNotify;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
interface ConstantVariableState extends SceneVariableState {
|
|
496
|
+
value: string;
|
|
497
|
+
}
|
|
498
|
+
declare class ConstantVariable extends SceneObjectBase<ConstantVariableState> implements SceneVariable<ConstantVariableState> {
|
|
499
|
+
constructor(initialState: Partial<ConstantVariableState>);
|
|
500
|
+
getValue(): VariableValue;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
interface MultiValueVariableState extends SceneVariableState {
|
|
504
|
+
value: VariableValue;
|
|
505
|
+
text: VariableValue;
|
|
506
|
+
options: VariableValueOption[];
|
|
507
|
+
isMulti?: boolean;
|
|
508
|
+
includeAll?: boolean;
|
|
509
|
+
defaultToAll?: boolean;
|
|
510
|
+
allValue?: string;
|
|
511
|
+
placeholder?: string;
|
|
512
|
+
}
|
|
513
|
+
interface VariableGetOptionsArgs {
|
|
514
|
+
searchFilter?: string;
|
|
515
|
+
}
|
|
516
|
+
declare abstract class MultiValueVariable<TState extends MultiValueVariableState = MultiValueVariableState> extends SceneObjectBase<TState> implements SceneVariable<TState> {
|
|
517
|
+
protected _urlSync: SceneObjectUrlSyncHandler<TState>;
|
|
518
|
+
/**
|
|
519
|
+
* The source of value options.
|
|
520
|
+
*/
|
|
521
|
+
abstract getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
|
522
|
+
/**
|
|
523
|
+
* This function is called on when SceneVariableSet is activated or when a dependency changes.
|
|
524
|
+
*/
|
|
525
|
+
validateAndUpdate(): Observable<ValidateAndUpdateResult>;
|
|
526
|
+
/**
|
|
527
|
+
* Check if current value is valid given new options. If not update the value.
|
|
528
|
+
*/
|
|
529
|
+
private updateValueGivenNewOptions;
|
|
530
|
+
getValue(): VariableValue;
|
|
531
|
+
getValueText(): string;
|
|
532
|
+
private hasAllValue;
|
|
533
|
+
private getDefaultMultiState;
|
|
534
|
+
/**
|
|
535
|
+
* Change the value and publish SceneVariableValueChangedEvent event
|
|
536
|
+
*/
|
|
537
|
+
changeValueTo(value: VariableValue, text?: VariableValue): void;
|
|
538
|
+
private findLabelTextForValue;
|
|
539
|
+
/**
|
|
540
|
+
* This helper function is to counter the contravariance of setState
|
|
541
|
+
*/
|
|
542
|
+
private setStateHelper;
|
|
543
|
+
getOptionsForSelect(): VariableValueOption[];
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
interface CustomVariableState extends MultiValueVariableState {
|
|
547
|
+
query: string;
|
|
548
|
+
}
|
|
549
|
+
declare class CustomVariable extends MultiValueVariable<CustomVariableState> {
|
|
550
|
+
protected _variableDependency: VariableDependencyConfig<CustomVariableState>;
|
|
551
|
+
constructor(initialState: Partial<CustomVariableState>);
|
|
552
|
+
getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
|
553
|
+
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => JSX.Element;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
interface DataSourceVariableState extends MultiValueVariableState {
|
|
557
|
+
query: string;
|
|
558
|
+
regex: string;
|
|
559
|
+
}
|
|
560
|
+
declare class DataSourceVariable extends MultiValueVariable<DataSourceVariableState> {
|
|
561
|
+
protected _variableDependency: VariableDependencyConfig<DataSourceVariableState>;
|
|
562
|
+
constructor(initialState: Partial<DataSourceVariableState>);
|
|
563
|
+
getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
|
564
|
+
private getDataSourceTypes;
|
|
565
|
+
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => JSX.Element;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
interface QueryVariableState extends MultiValueVariableState {
|
|
569
|
+
type: 'query';
|
|
570
|
+
datasource: DataSourceRef | null;
|
|
571
|
+
query: any;
|
|
572
|
+
regex: string;
|
|
573
|
+
refresh: VariableRefresh;
|
|
574
|
+
sort: VariableSort;
|
|
575
|
+
}
|
|
576
|
+
declare class QueryVariable extends MultiValueVariable<QueryVariableState> {
|
|
577
|
+
private updateSubscription?;
|
|
578
|
+
private dataSourceSubject?;
|
|
579
|
+
protected _variableDependency: VariableDependencyConfig<QueryVariableState>;
|
|
580
|
+
constructor(initialState: Partial<QueryVariableState>);
|
|
581
|
+
activate(): void;
|
|
582
|
+
deactivate(): void;
|
|
583
|
+
getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
|
584
|
+
private getDataSource;
|
|
585
|
+
private getRequest;
|
|
586
|
+
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => JSX.Element;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
interface TestVariableState extends MultiValueVariableState {
|
|
590
|
+
query: string;
|
|
591
|
+
delayMs?: number;
|
|
592
|
+
issuedQuery?: string;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* This variable is only designed for unit tests and potentially e2e tests.
|
|
596
|
+
*/
|
|
597
|
+
declare class TestVariable extends MultiValueVariable<TestVariableState> {
|
|
598
|
+
private completeUpdate;
|
|
599
|
+
isGettingValues: boolean;
|
|
600
|
+
getValueOptionsCount: number;
|
|
601
|
+
protected _variableDependency: VariableDependencyConfig<TestVariableState>;
|
|
602
|
+
constructor(initialState: Partial<TestVariableState>);
|
|
603
|
+
getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
|
604
|
+
private issueQuery;
|
|
605
|
+
/** Useful from tests */
|
|
606
|
+
signalUpdateCompleted(): void;
|
|
607
|
+
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => JSX.Element;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
declare class UrlSyncManager {
|
|
611
|
+
private sceneRoot;
|
|
612
|
+
private locationListenerUnsub;
|
|
613
|
+
private stateChangeSub;
|
|
614
|
+
private initialStates;
|
|
615
|
+
private urlKeyMapper;
|
|
616
|
+
constructor(sceneRoot: SceneObject);
|
|
617
|
+
/**
|
|
618
|
+
* Updates the current scene state to match URL state.
|
|
619
|
+
*/
|
|
620
|
+
initSync(): void;
|
|
621
|
+
private onLocationUpdate;
|
|
622
|
+
private onStateChanged;
|
|
623
|
+
cleanUp(): void;
|
|
624
|
+
private syncSceneStateFromUrl;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
interface SceneState extends SceneObjectStatePlain {
|
|
628
|
+
title: string;
|
|
629
|
+
body: SceneObject;
|
|
630
|
+
actions?: SceneObject[];
|
|
631
|
+
subMenu?: SceneObject;
|
|
632
|
+
isEditing?: boolean;
|
|
633
|
+
}
|
|
634
|
+
declare class EmbeddedScene extends SceneObjectBase<SceneState> {
|
|
635
|
+
static Component: typeof EmbeddedSceneRenderer;
|
|
636
|
+
private urlSyncManager?;
|
|
637
|
+
activate(): void;
|
|
638
|
+
deactivate(): void;
|
|
639
|
+
}
|
|
640
|
+
declare function EmbeddedSceneRenderer({ model }: SceneComponentProps<EmbeddedScene>): JSX.Element;
|
|
641
|
+
|
|
642
|
+
declare function VizPanelRenderer({ model }: SceneComponentProps<VizPanel>): JSX.Element;
|
|
643
|
+
declare namespace VizPanelRenderer {
|
|
644
|
+
var displayName: string;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneLayoutChildState {
|
|
648
|
+
title: string;
|
|
649
|
+
pluginId: string;
|
|
650
|
+
options: DeepPartial<TOptions>;
|
|
651
|
+
fieldConfig: FieldConfigSource<DeepPartial<TFieldConfig>>;
|
|
652
|
+
pluginVersion?: string;
|
|
653
|
+
pluginLoadError?: string;
|
|
654
|
+
}
|
|
655
|
+
declare class VizPanel<TOptions = {}, TFieldConfig = {}> extends SceneObjectBase<VizPanelState<TOptions, TFieldConfig>> {
|
|
656
|
+
static Component: typeof VizPanelRenderer;
|
|
657
|
+
static Editor: typeof VizPanelEditor;
|
|
658
|
+
private _plugin?;
|
|
659
|
+
constructor(state: Partial<VizPanelState<TOptions, TFieldConfig>>);
|
|
660
|
+
activate(): void;
|
|
661
|
+
private pluginLoaded;
|
|
662
|
+
private getPluginVersion;
|
|
663
|
+
getPlugin(): PanelPlugin | undefined;
|
|
664
|
+
onChangeTimeRange: (timeRange: AbsoluteTimeRange) => void;
|
|
665
|
+
onOptionsChange: (options: TOptions) => void;
|
|
666
|
+
onFieldConfigChange: (fieldConfig: FieldConfigSource<TFieldConfig>) => void;
|
|
667
|
+
}
|
|
668
|
+
declare function VizPanelEditor({ model }: SceneComponentProps<VizPanel>): JSX.Element;
|
|
669
|
+
|
|
670
|
+
interface NestedSceneState extends SceneLayoutChildState {
|
|
671
|
+
title: string;
|
|
672
|
+
isCollapsed?: boolean;
|
|
673
|
+
canCollapse?: boolean;
|
|
674
|
+
canRemove?: boolean;
|
|
675
|
+
body: SceneLayout;
|
|
676
|
+
actions?: SceneObject[];
|
|
677
|
+
}
|
|
678
|
+
declare class NestedScene extends SceneObjectBase<NestedSceneState> {
|
|
679
|
+
static Component: typeof NestedSceneRenderer;
|
|
680
|
+
onToggle: () => void;
|
|
681
|
+
/** Removes itself from its parent's children array */
|
|
682
|
+
onRemove: () => void;
|
|
683
|
+
}
|
|
684
|
+
declare function NestedSceneRenderer({ model, isEditing }: SceneComponentProps<NestedScene>): JSX.Element;
|
|
685
|
+
|
|
686
|
+
interface SceneCanvasTextState extends SceneLayoutChildState {
|
|
687
|
+
text: string;
|
|
688
|
+
fontSize?: number;
|
|
689
|
+
align?: 'left' | 'center' | 'right';
|
|
690
|
+
}
|
|
691
|
+
declare class SceneCanvasText extends SceneObjectBase<SceneCanvasTextState> {
|
|
692
|
+
static Editor: typeof Editor;
|
|
693
|
+
protected _variableDependency: VariableDependencyConfig<SceneCanvasTextState>;
|
|
694
|
+
static Component: ({ model }: SceneComponentProps<SceneCanvasText>) => JSX.Element;
|
|
695
|
+
}
|
|
696
|
+
declare function Editor({ model }: SceneComponentProps<SceneCanvasText>): JSX.Element;
|
|
697
|
+
|
|
698
|
+
interface ToolbarButtonState extends SceneObjectStatePlain {
|
|
699
|
+
icon: IconName;
|
|
700
|
+
onClick: () => void;
|
|
701
|
+
}
|
|
702
|
+
declare class SceneToolbarButton extends SceneObjectBase<ToolbarButtonState> {
|
|
703
|
+
static Component: ({ model }: SceneComponentProps<SceneToolbarButton>) => JSX.Element;
|
|
704
|
+
}
|
|
705
|
+
interface SceneToolbarInputState extends SceneObjectStatePlain {
|
|
706
|
+
value?: string;
|
|
707
|
+
onChange: (value: number) => void;
|
|
708
|
+
}
|
|
709
|
+
declare class SceneToolbarInput extends SceneObjectBase<SceneToolbarInputState> {
|
|
710
|
+
static Component: ({ model }: SceneComponentProps<SceneToolbarInput>) => JSX.Element;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
interface SceneTimePickerState extends SceneObjectStatePlain {
|
|
714
|
+
hidePicker?: boolean;
|
|
715
|
+
}
|
|
716
|
+
declare class SceneTimePicker extends SceneObjectBase<SceneTimePickerState> {
|
|
717
|
+
static Component: typeof SceneTimePickerRenderer;
|
|
718
|
+
}
|
|
719
|
+
declare function SceneTimePickerRenderer({ model }: SceneComponentProps<SceneTimePicker>): JSX.Element | null;
|
|
720
|
+
|
|
721
|
+
interface RepeatOptions extends SceneObjectStatePlain {
|
|
722
|
+
layout: SceneObject<SceneLayoutState>;
|
|
723
|
+
}
|
|
724
|
+
declare class ScenePanelRepeater extends SceneObjectBase<RepeatOptions> {
|
|
725
|
+
activate(): void;
|
|
726
|
+
private performRepeat;
|
|
727
|
+
static Component: ({ model, isEditing }: SceneComponentProps<ScenePanelRepeater>) => JSX.Element;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
interface SceneSubMenuState extends SceneLayoutState {
|
|
731
|
+
}
|
|
732
|
+
declare class SceneSubMenu extends SceneObjectBase<SceneSubMenuState> {
|
|
733
|
+
static Component: typeof SceneSubMenuRenderer;
|
|
734
|
+
}
|
|
735
|
+
declare function SceneSubMenuRenderer({ model }: SceneComponentProps<SceneSubMenu>): JSX.Element;
|
|
736
|
+
|
|
737
|
+
type FlexLayoutDirection = 'column' | 'row';
|
|
738
|
+
interface SceneFlexLayoutState extends SceneLayoutState {
|
|
739
|
+
direction?: FlexLayoutDirection;
|
|
740
|
+
}
|
|
741
|
+
declare class SceneFlexLayout extends SceneObjectBase<SceneFlexLayoutState> {
|
|
742
|
+
static Component: typeof FlexLayoutRenderer;
|
|
743
|
+
static Editor: typeof FlexLayoutEditor;
|
|
744
|
+
toggleDirection(): void;
|
|
745
|
+
}
|
|
746
|
+
declare function FlexLayoutRenderer({ model, isEditing }: SceneComponentProps<SceneFlexLayout>): JSX.Element;
|
|
747
|
+
declare function FlexLayoutEditor({ model }: SceneComponentProps<SceneFlexLayout>): JSX.Element;
|
|
748
|
+
|
|
749
|
+
interface SceneGridRowState extends SceneLayoutChildState {
|
|
750
|
+
title: string;
|
|
751
|
+
isCollapsible?: boolean;
|
|
752
|
+
isCollapsed?: boolean;
|
|
753
|
+
children: Array<SceneObject<SceneLayoutChildState>>;
|
|
754
|
+
}
|
|
755
|
+
declare class SceneGridRow extends SceneObjectBase<SceneGridRowState> {
|
|
756
|
+
static Component: typeof SceneGridRowRenderer;
|
|
757
|
+
protected _urlSync: SceneObjectUrlSyncConfig<SceneGridRowState>;
|
|
758
|
+
constructor(state: SceneGridRowState);
|
|
759
|
+
onCollapseToggle: () => void;
|
|
760
|
+
getUrlState(state: SceneGridRowState): {
|
|
761
|
+
rowc: string;
|
|
762
|
+
};
|
|
763
|
+
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
764
|
+
}
|
|
765
|
+
declare function SceneGridRowRenderer({ model }: SceneComponentProps<SceneGridRow>): JSX.Element;
|
|
766
|
+
|
|
767
|
+
interface SceneGridLayoutState extends SceneLayoutState {
|
|
768
|
+
}
|
|
769
|
+
declare class SceneGridLayout extends SceneObjectBase<SceneGridLayoutState> {
|
|
770
|
+
static Component: typeof SceneGridLayoutRenderer;
|
|
771
|
+
private _skipOnLayoutChange;
|
|
772
|
+
constructor(state: SceneGridLayoutState);
|
|
773
|
+
toggleRow(row: SceneGridRow): void;
|
|
774
|
+
onLayoutChange: (layout: ReactGridLayout.Layout[]) => void;
|
|
775
|
+
/**
|
|
776
|
+
* Will also scan row children and return child of the row
|
|
777
|
+
*/
|
|
778
|
+
getSceneLayoutChild(key: string): SceneLayoutChild;
|
|
779
|
+
onResizeStop: ReactGridLayout.ItemCallback;
|
|
780
|
+
private pushChildDown;
|
|
781
|
+
/**
|
|
782
|
+
* We assume the layout array is storted according to y pos, and walk upwards until we find a row.
|
|
783
|
+
* If it is collapsed there is no row to add it to. The default is then to return the SceneGridLayout itself
|
|
784
|
+
*/
|
|
785
|
+
private findGridItemSceneParent;
|
|
786
|
+
/**
|
|
787
|
+
* This likely needs a slighltly different approach. Where we clone or deactivate or and re-activate the moved child
|
|
788
|
+
*/
|
|
789
|
+
moveChildTo(child: SceneLayoutChild, target: SceneGridLayout | SceneGridRow): SceneLayoutChild[];
|
|
790
|
+
onDragStop: ReactGridLayout.ItemCallback;
|
|
791
|
+
private toGridCell;
|
|
792
|
+
buildGridLayout(width: number): ReactGridLayout.Layout[];
|
|
793
|
+
}
|
|
794
|
+
declare function SceneGridLayoutRenderer({ model }: SceneComponentProps<SceneGridLayout>): JSX.Element;
|
|
795
|
+
|
|
796
|
+
export { ConstantVariable, CustomFormatterFn, CustomVariable, DataSourceVariable, DeepPartial, EmbeddedScene, FormatRegistryID, FormatVariable, NestedScene, QueryRunnerState, QueryVariable, SceneCanvasText, SceneComponent, SceneComponentProps, SceneDataNode, SceneDataState, SceneDataTransformer, SceneEditor, SceneEditorState, SceneFlexLayout, SceneGridLayout, SceneGridRow, SceneLayout, SceneLayoutChild, SceneLayoutChildOptions, SceneLayoutChildState, SceneLayoutState, SceneObject, SceneObjectBase, SceneObjectRef, SceneObjectState, SceneObjectStateChangedEvent, SceneObjectStateChangedPayload, SceneObjectStatePlain, SceneObjectUrlSyncConfig, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, ScenePanelRepeater, SceneQueryRunner, SceneState, SceneSubMenu, SceneTimePicker, SceneTimeRange, SceneTimeRangeLike, SceneTimeRangeState, SceneToolbarButton, SceneToolbarInput, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSet, SceneVariableSetState, SceneVariableState, SceneVariableValueChangedEvent, SceneVariables, TestVariable, UrlSyncManager, ValidateAndUpdateResult, VariableValue, VariableValueCustom, VariableValueOption, VariableValueSelectors, VariableValueSingle, VizPanel, VizPanelState, formatRegistry, isSceneObject, sceneGraph };
|