@grafana/scenes 4.5.5--canary.682.8607605361.0 → 4.5.5
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 +12 -0
- package/dist/esm/components/layout/LazyLoader.js.map +1 -1
- package/dist/esm/components/layout/grid/SceneGridLayoutRenderer.js.map +1 -1
- package/dist/esm/core/SceneObjectBase.js +9 -3
- package/dist/esm/core/SceneObjectBase.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js +14 -24
- package/dist/esm/variables/adhoc/AdHocFiltersVariable.js.map +1 -1
- package/dist/esm/variables/groupby/GroupByVariable.js.map +1 -1
- package/dist/esm/variables/variants/guards.js.map +1 -1
- package/dist/index.d.ts +47 -47
- package/dist/index.js +21 -25
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as _grafana_data from '@grafana/data';
|
|
2
2
|
import { BusEventWithPayload, PanelData, BusEvent, BusEventType, BusEventHandler, TimeRange, DataQueryRequest, DataTransformContext, DataFrame, PanelPlugin, EventBus, DataQuery, DataSourceApi, Registry, RegistryItem, ScopedVars, AdHocVariableFilter, SelectableValue, MetricFindValue, VariableRefresh as VariableRefresh$1, VariableSort, EventFilterOptions, AnnotationEvent, AnnotationQuery, DataTransformerConfig, PanelMenuItem, FieldConfigSource, PanelModel, AbsoluteTimeRange, InterpolateFunction, IconName as IconName$1, FieldConfig, FieldType, FieldValueMatcherConfig } from '@grafana/data';
|
|
3
|
-
import
|
|
4
|
-
import React__default, { CSSProperties, ComponentType } from 'react';
|
|
3
|
+
import React$1, { CSSProperties, ComponentType } from 'react';
|
|
5
4
|
import * as rxjs from 'rxjs';
|
|
6
5
|
import { Observable, Unsubscribable, MonoTypeOperatorFunction, Subscription, ReplaySubject } from 'rxjs';
|
|
7
6
|
import * as _grafana_schema from '@grafana/schema';
|
|
@@ -153,7 +152,7 @@ interface SceneLayoutChildOptions {
|
|
|
153
152
|
interface SceneComponentProps<T> {
|
|
154
153
|
model: T;
|
|
155
154
|
}
|
|
156
|
-
type SceneComponent<TModel> = (props: SceneComponentProps<TModel>) =>
|
|
155
|
+
type SceneComponent<TModel> = (props: SceneComponentProps<TModel>) => React$1.ReactElement | null;
|
|
157
156
|
interface SceneDataState extends SceneObjectState {
|
|
158
157
|
data?: PanelData;
|
|
159
158
|
}
|
|
@@ -188,7 +187,7 @@ interface SceneObject<TState extends SceneObjectState = SceneObjectState> {
|
|
|
188
187
|
/** Returns a deep clone this object and all its children */
|
|
189
188
|
clone(state?: Partial<TState>): this;
|
|
190
189
|
/** A React component to use for rendering the object */
|
|
191
|
-
Component(props: SceneComponentProps<SceneObject<TState>>):
|
|
190
|
+
Component(props: SceneComponentProps<SceneObject<TState>>): React$1.ReactElement | null;
|
|
192
191
|
/** Force a re-render, should only be needed when variable values change */
|
|
193
192
|
forceRender(): void;
|
|
194
193
|
/** Returns a SceneObjectRef that will resolve to this object */
|
|
@@ -514,12 +513,13 @@ interface AdHocFiltersVariableState extends SceneVariableState {
|
|
|
514
513
|
* The default builder creates a Prometheus/Loki compatible filter expression,
|
|
515
514
|
* this can be overridden to create a different expression based on the current filters.
|
|
516
515
|
*/
|
|
517
|
-
expressionBuilder?:
|
|
516
|
+
expressionBuilder?: AdHocVariableExpressionBuilderFn;
|
|
518
517
|
/**
|
|
519
518
|
* @internal state of the new filter being added
|
|
520
519
|
*/
|
|
521
520
|
_wip?: AdHocVariableFilter;
|
|
522
521
|
}
|
|
522
|
+
type AdHocVariableExpressionBuilderFn = (filters: AdHocVariableFilter[]) => string;
|
|
523
523
|
type getTagKeysProvider$1 = (variable: AdHocFiltersVariable, currentKey: string | null) => Promise<{
|
|
524
524
|
replace?: boolean;
|
|
525
525
|
values: MetricFindValue[];
|
|
@@ -534,8 +534,8 @@ declare class AdHocFiltersVariable extends SceneObjectBase<AdHocFiltersVariableS
|
|
|
534
534
|
private _dataSourceSrv;
|
|
535
535
|
protected _urlSync: AdHocFiltersVariableUrlSyncHandler;
|
|
536
536
|
constructor(state: Partial<AdHocFiltersVariableState>);
|
|
537
|
+
setState(update: Partial<AdHocFiltersVariableState>): void;
|
|
537
538
|
getValue(): VariableValue | undefined;
|
|
538
|
-
private _updateFilterExpression;
|
|
539
539
|
_updateFilter(filter: AdHocVariableFilter, prop: keyof AdHocVariableFilter, value: string | undefined | null): void;
|
|
540
540
|
_removeFilter(filter: AdHocVariableFilter): void;
|
|
541
541
|
/**
|
|
@@ -553,7 +553,7 @@ declare class AdHocFiltersVariable extends SceneObjectBase<AdHocFiltersVariableS
|
|
|
553
553
|
*/
|
|
554
554
|
private _getSceneQueries;
|
|
555
555
|
}
|
|
556
|
-
declare function AdHocFiltersVariableRenderer({ model }: SceneComponentProps<AdHocFiltersVariable>):
|
|
556
|
+
declare function AdHocFiltersVariableRenderer({ model }: SceneComponentProps<AdHocFiltersVariable>): JSX.Element;
|
|
557
557
|
|
|
558
558
|
interface ConstantVariableState extends SceneVariableState {
|
|
559
559
|
value: VariableValue;
|
|
@@ -690,7 +690,7 @@ declare class CustomVariable extends MultiValueVariable<CustomVariableState> {
|
|
|
690
690
|
protected _variableDependency: VariableDependencyConfig<CustomVariableState>;
|
|
691
691
|
constructor(initialState: Partial<CustomVariableState>);
|
|
692
692
|
getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
|
693
|
-
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) =>
|
|
693
|
+
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => JSX.Element;
|
|
694
694
|
}
|
|
695
695
|
|
|
696
696
|
interface DataSourceVariableState extends MultiValueVariableState {
|
|
@@ -711,7 +711,7 @@ declare class DataSourceVariable extends MultiValueVariable<DataSourceVariableSt
|
|
|
711
711
|
protected _variableDependency: VariableDependencyConfig<DataSourceVariableState>;
|
|
712
712
|
constructor(initialState: Partial<DataSourceVariableState>);
|
|
713
713
|
getValueOptions(args: VariableGetOptionsArgs): Observable<VariableValueOption[]>;
|
|
714
|
-
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) =>
|
|
714
|
+
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => JSX.Element;
|
|
715
715
|
}
|
|
716
716
|
|
|
717
717
|
interface IntervalVariableState extends SceneVariableState {
|
|
@@ -734,7 +734,7 @@ declare class IntervalVariable extends SceneObjectBase<IntervalVariableState> im
|
|
|
734
734
|
private getAutoRefreshInteval;
|
|
735
735
|
_onChange: (value: SelectableValue<string>) => void;
|
|
736
736
|
validateAndUpdate(): Observable<ValidateAndUpdateResult>;
|
|
737
|
-
static Component: ({ model }: SceneComponentProps<IntervalVariable>) =>
|
|
737
|
+
static Component: ({ model }: SceneComponentProps<IntervalVariable>) => JSX.Element;
|
|
738
738
|
}
|
|
739
739
|
|
|
740
740
|
interface TextBoxVariableState extends SceneVariableState {
|
|
@@ -749,7 +749,7 @@ declare class TextBoxVariable extends SceneObjectBase<TextBoxVariableState> impl
|
|
|
749
749
|
[x: string]: string;
|
|
750
750
|
};
|
|
751
751
|
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
752
|
-
static Component: ({ model }: SceneComponentProps<TextBoxVariable>) =>
|
|
752
|
+
static Component: ({ model }: SceneComponentProps<TextBoxVariable>) => JSX.Element;
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
interface QueryRunnerState extends SceneObjectState {
|
|
@@ -848,7 +848,7 @@ declare class QueryVariable extends MultiValueVariable<QueryVariableState> {
|
|
|
848
848
|
private getRequest;
|
|
849
849
|
onSearchChange: (searchFilter: string) => void;
|
|
850
850
|
private _updateOptionsBasedOnSearchFilter;
|
|
851
|
-
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) =>
|
|
851
|
+
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => JSX.Element;
|
|
852
852
|
}
|
|
853
853
|
|
|
854
854
|
interface GroupByVariableState extends MultiValueVariableState {
|
|
@@ -910,7 +910,7 @@ declare class GroupByVariable extends MultiValueVariable<GroupByVariableState> {
|
|
|
910
910
|
*/
|
|
911
911
|
private _getSceneQueries;
|
|
912
912
|
}
|
|
913
|
-
declare function GroupByVariableRenderer({ model }: SceneComponentProps<MultiValueVariable>):
|
|
913
|
+
declare function GroupByVariableRenderer({ model }: SceneComponentProps<MultiValueVariable>): JSX.Element;
|
|
914
914
|
|
|
915
915
|
declare function isAdHocVariable(variable: SceneVariable): variable is AdHocFiltersVariable;
|
|
916
916
|
declare function isConstantVariable(variable: SceneVariable): variable is ConstantVariable;
|
|
@@ -1197,7 +1197,7 @@ declare class AnnotationsDataLayer extends SceneDataLayerBase<AnnotationsDataLay
|
|
|
1197
1197
|
traceIds?: string[];
|
|
1198
1198
|
};
|
|
1199
1199
|
}
|
|
1200
|
-
declare function AnnotationsDataLayerRenderer({ model }: SceneComponentProps<AnnotationsDataLayer>):
|
|
1200
|
+
declare function AnnotationsDataLayerRenderer({ model }: SceneComponentProps<AnnotationsDataLayer>): JSX.Element;
|
|
1201
1201
|
|
|
1202
1202
|
type index_AnnotationsDataLayer = AnnotationsDataLayer;
|
|
1203
1203
|
declare const index_AnnotationsDataLayer: typeof AnnotationsDataLayer;
|
|
@@ -1295,7 +1295,7 @@ interface SceneDataLayersSetState extends SceneDataLayerProviderState {
|
|
|
1295
1295
|
declare class SceneDataLayerSet extends SceneDataLayerSetBase<SceneDataLayersSetState> implements SceneDataLayerProvider {
|
|
1296
1296
|
constructor(state: Partial<SceneDataLayersSetState>);
|
|
1297
1297
|
private _onActivate;
|
|
1298
|
-
static Component: ({ model }: SceneComponentProps<SceneDataLayerSet>) =>
|
|
1298
|
+
static Component: ({ model }: SceneComponentProps<SceneDataLayerSet>) => JSX.Element;
|
|
1299
1299
|
}
|
|
1300
1300
|
|
|
1301
1301
|
interface SceneDataLayerControlsState extends SceneObjectState {
|
|
@@ -1304,7 +1304,7 @@ declare class SceneDataLayerControls extends SceneObjectBase<SceneDataLayerContr
|
|
|
1304
1304
|
static Component: typeof SceneDataLayerControlsRenderer;
|
|
1305
1305
|
constructor();
|
|
1306
1306
|
}
|
|
1307
|
-
declare function SceneDataLayerControlsRenderer({ model }: SceneComponentProps<SceneDataLayerControls>):
|
|
1307
|
+
declare function SceneDataLayerControlsRenderer({ model }: SceneComponentProps<SceneDataLayerControls>): JSX.Element;
|
|
1308
1308
|
|
|
1309
1309
|
interface SceneDataTransformerState extends SceneDataState {
|
|
1310
1310
|
/**
|
|
@@ -1349,7 +1349,7 @@ interface VariableValueSelectorsState extends SceneObjectState {
|
|
|
1349
1349
|
declare class VariableValueSelectors extends SceneObjectBase<VariableValueSelectorsState> {
|
|
1350
1350
|
static Component: typeof VariableValueSelectorsRenderer;
|
|
1351
1351
|
}
|
|
1352
|
-
declare function VariableValueSelectorsRenderer({ model }: SceneComponentProps<VariableValueSelectors>):
|
|
1352
|
+
declare function VariableValueSelectorsRenderer({ model }: SceneComponentProps<VariableValueSelectors>): JSX.Element;
|
|
1353
1353
|
|
|
1354
1354
|
interface VariableValueControlState extends SceneObjectState {
|
|
1355
1355
|
layout?: ControlsLayout;
|
|
@@ -1359,7 +1359,7 @@ interface VariableValueControlState extends SceneObjectState {
|
|
|
1359
1359
|
declare class VariableValueControl extends SceneObjectBase<VariableValueControlState> {
|
|
1360
1360
|
static Component: typeof VariableValueControlRenderer;
|
|
1361
1361
|
}
|
|
1362
|
-
declare function VariableValueControlRenderer({ model }: SceneComponentProps<VariableValueControl>):
|
|
1362
|
+
declare function VariableValueControlRenderer({ model }: SceneComponentProps<VariableValueControl>): JSX.Element;
|
|
1363
1363
|
|
|
1364
1364
|
declare class SceneVariableSet extends SceneObjectBase<SceneVariableSetState> implements SceneVariables {
|
|
1365
1365
|
/** Variables that have changed in since the activation or since the first manual value change */
|
|
@@ -1461,7 +1461,7 @@ declare class TestVariable extends MultiValueVariable<TestVariableState> {
|
|
|
1461
1461
|
private getOptions;
|
|
1462
1462
|
/** Useful from tests */
|
|
1463
1463
|
signalUpdateCompleted(): void;
|
|
1464
|
-
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) =>
|
|
1464
|
+
static Component: ({ model }: SceneComponentProps<MultiValueVariable>) => JSX.Element;
|
|
1465
1465
|
}
|
|
1466
1466
|
|
|
1467
1467
|
interface LocalValueVariableState extends SceneVariableState {
|
|
@@ -1530,9 +1530,9 @@ declare class EmbeddedScene extends SceneObjectBase<EmbeddedSceneState> {
|
|
|
1530
1530
|
*/
|
|
1531
1531
|
initUrlSync(): void;
|
|
1532
1532
|
}
|
|
1533
|
-
declare function EmbeddedSceneRenderer({ model }: SceneComponentProps<EmbeddedScene>):
|
|
1533
|
+
declare function EmbeddedSceneRenderer({ model }: SceneComponentProps<EmbeddedScene>): JSX.Element;
|
|
1534
1534
|
|
|
1535
|
-
declare function VizPanelRenderer({ model }: SceneComponentProps<VizPanel>):
|
|
1535
|
+
declare function VizPanelRenderer({ model }: SceneComponentProps<VizPanel>): JSX.Element;
|
|
1536
1536
|
|
|
1537
1537
|
interface VizPanelMenuState extends SceneObjectState {
|
|
1538
1538
|
items?: PanelMenuItem[];
|
|
@@ -1542,7 +1542,7 @@ declare class VizPanelMenu extends SceneObjectBase<VizPanelMenuState> {
|
|
|
1542
1542
|
addItem(item: PanelMenuItem): void;
|
|
1543
1543
|
setItems(items: PanelMenuItem[]): void;
|
|
1544
1544
|
}
|
|
1545
|
-
declare function VizPanelMenuRenderer({ model }: SceneComponentProps<VizPanelMenu>):
|
|
1545
|
+
declare function VizPanelMenuRenderer({ model }: SceneComponentProps<VizPanelMenu>): JSX.Element;
|
|
1546
1546
|
|
|
1547
1547
|
interface VizPanelState<TOptions = {}, TFieldConfig = {}> extends SceneObjectState {
|
|
1548
1548
|
/**
|
|
@@ -1646,7 +1646,7 @@ declare class NestedScene extends SceneObjectBase<NestedSceneState> {
|
|
|
1646
1646
|
/** Removes itself from its parent's children array */
|
|
1647
1647
|
onRemove: () => void;
|
|
1648
1648
|
}
|
|
1649
|
-
declare function NestedSceneRenderer({ model }: SceneComponentProps<NestedScene>):
|
|
1649
|
+
declare function NestedSceneRenderer({ model }: SceneComponentProps<NestedScene>): JSX.Element;
|
|
1650
1650
|
|
|
1651
1651
|
interface SceneCanvasTextState extends SceneObjectState {
|
|
1652
1652
|
text: string;
|
|
@@ -1660,7 +1660,7 @@ interface SceneCanvasTextState extends SceneObjectState {
|
|
|
1660
1660
|
*/
|
|
1661
1661
|
declare class SceneCanvasText extends SceneObjectBase<SceneCanvasTextState> {
|
|
1662
1662
|
protected _variableDependency: VariableDependencyConfig<SceneCanvasTextState>;
|
|
1663
|
-
static Component: ({ model }: SceneComponentProps<SceneCanvasText>) =>
|
|
1663
|
+
static Component: ({ model }: SceneComponentProps<SceneCanvasText>) => JSX.Element;
|
|
1664
1664
|
}
|
|
1665
1665
|
|
|
1666
1666
|
interface ToolbarButtonState extends SceneObjectState {
|
|
@@ -1668,7 +1668,7 @@ interface ToolbarButtonState extends SceneObjectState {
|
|
|
1668
1668
|
onClick: () => void;
|
|
1669
1669
|
}
|
|
1670
1670
|
declare class SceneToolbarButton extends SceneObjectBase<ToolbarButtonState> {
|
|
1671
|
-
static Component: ({ model }: SceneComponentProps<SceneToolbarButton>) =>
|
|
1671
|
+
static Component: ({ model }: SceneComponentProps<SceneToolbarButton>) => JSX.Element;
|
|
1672
1672
|
}
|
|
1673
1673
|
interface SceneToolbarInputState extends SceneObjectState {
|
|
1674
1674
|
value?: string;
|
|
@@ -1676,7 +1676,7 @@ interface SceneToolbarInputState extends SceneObjectState {
|
|
|
1676
1676
|
onChange: (value: number) => void;
|
|
1677
1677
|
}
|
|
1678
1678
|
declare class SceneToolbarInput extends SceneObjectBase<SceneToolbarInputState> {
|
|
1679
|
-
static Component: ({ model }: SceneComponentProps<SceneToolbarInput>) =>
|
|
1679
|
+
static Component: ({ model }: SceneComponentProps<SceneToolbarInput>) => JSX.Element;
|
|
1680
1680
|
}
|
|
1681
1681
|
|
|
1682
1682
|
interface SceneTimePickerState extends SceneObjectState {
|
|
@@ -1690,7 +1690,7 @@ declare class SceneTimePicker extends SceneObjectBase<SceneTimePickerState> {
|
|
|
1690
1690
|
onMoveBackward: () => void;
|
|
1691
1691
|
onMoveForward: () => void;
|
|
1692
1692
|
}
|
|
1693
|
-
declare function SceneTimePickerRenderer({ model }: SceneComponentProps<SceneTimePicker>):
|
|
1693
|
+
declare function SceneTimePickerRenderer({ model }: SceneComponentProps<SceneTimePicker>): JSX.Element;
|
|
1694
1694
|
|
|
1695
1695
|
interface SceneRefreshPickerState extends SceneObjectState {
|
|
1696
1696
|
refresh: string;
|
|
@@ -1718,7 +1718,7 @@ declare class SceneRefreshPicker extends SceneObjectBase<SceneRefreshPickerState
|
|
|
1718
1718
|
private calculateAutoRefreshInterval;
|
|
1719
1719
|
private setupIntervalTimer;
|
|
1720
1720
|
}
|
|
1721
|
-
declare function SceneRefreshPickerRenderer({ model }: SceneComponentProps<SceneRefreshPicker>):
|
|
1721
|
+
declare function SceneRefreshPickerRenderer({ model }: SceneComponentProps<SceneRefreshPicker>): JSX.Element;
|
|
1722
1722
|
|
|
1723
1723
|
interface TimeRangeCompareProvider {
|
|
1724
1724
|
getCompareTimeRange(timeRange: TimeRange): TimeRange | undefined;
|
|
@@ -1745,7 +1745,7 @@ declare class SceneTimeRangeCompare extends SceneObjectBase<SceneTimeRangeCompar
|
|
|
1745
1745
|
getUrlState(): SceneObjectUrlValues;
|
|
1746
1746
|
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
1747
1747
|
}
|
|
1748
|
-
declare function SceneTimeRangeCompareRenderer({ model }: SceneComponentProps<SceneTimeRangeCompare>):
|
|
1748
|
+
declare function SceneTimeRangeCompareRenderer({ model }: SceneComponentProps<SceneTimeRangeCompare>): JSX.Element;
|
|
1749
1749
|
|
|
1750
1750
|
interface SceneByFrameRepeaterState extends SceneObjectState {
|
|
1751
1751
|
body: SceneLayout;
|
|
@@ -1754,7 +1754,7 @@ interface SceneByFrameRepeaterState extends SceneObjectState {
|
|
|
1754
1754
|
declare class SceneByFrameRepeater extends SceneObjectBase<SceneByFrameRepeaterState> {
|
|
1755
1755
|
constructor(state: SceneByFrameRepeaterState);
|
|
1756
1756
|
private performRepeat;
|
|
1757
|
-
static Component: ({ model }: SceneComponentProps<SceneByFrameRepeater>) =>
|
|
1757
|
+
static Component: ({ model }: SceneComponentProps<SceneByFrameRepeater>) => JSX.Element;
|
|
1758
1758
|
}
|
|
1759
1759
|
|
|
1760
1760
|
interface SceneByVariableRepeaterState extends SceneObjectState {
|
|
@@ -1766,13 +1766,13 @@ declare class SceneByVariableRepeater extends SceneObjectBase<SceneByVariableRep
|
|
|
1766
1766
|
protected _variableDependency: VariableDependencyConfig<SceneByVariableRepeaterState>;
|
|
1767
1767
|
constructor(state: SceneByVariableRepeaterState);
|
|
1768
1768
|
private performRepeat;
|
|
1769
|
-
static Component: ({ model }: SceneComponentProps<SceneByVariableRepeater>) =>
|
|
1769
|
+
static Component: ({ model }: SceneComponentProps<SceneByVariableRepeater>) => JSX.Element;
|
|
1770
1770
|
}
|
|
1771
1771
|
|
|
1772
1772
|
declare class SceneControlsSpacer extends SceneObjectBase {
|
|
1773
1773
|
constructor();
|
|
1774
|
-
get Component(): (_props: SceneComponentProps<SceneControlsSpacer>) =>
|
|
1775
|
-
static Component: (_props: SceneComponentProps<SceneControlsSpacer>) =>
|
|
1774
|
+
get Component(): (_props: SceneComponentProps<SceneControlsSpacer>) => JSX.Element;
|
|
1775
|
+
static Component: (_props: SceneComponentProps<SceneControlsSpacer>) => JSX.Element;
|
|
1776
1776
|
}
|
|
1777
1777
|
|
|
1778
1778
|
interface SceneFlexItemStateLike extends SceneFlexItemPlacement, SceneObjectState {
|
|
@@ -1787,7 +1787,7 @@ declare class SceneFlexLayout extends SceneObjectBase<SceneFlexLayoutState> impl
|
|
|
1787
1787
|
toggleDirection(): void;
|
|
1788
1788
|
isDraggable(): boolean;
|
|
1789
1789
|
}
|
|
1790
|
-
declare function SceneFlexLayoutRenderer({ model, parentState }: SceneFlexItemRenderProps$1<SceneFlexLayout>):
|
|
1790
|
+
declare function SceneFlexLayoutRenderer({ model, parentState }: SceneFlexItemRenderProps$1<SceneFlexLayout>): JSX.Element;
|
|
1791
1791
|
interface SceneFlexItemPlacement {
|
|
1792
1792
|
wrap?: CSSProperties['flexWrap'];
|
|
1793
1793
|
direction?: CSSProperties['flexDirection'];
|
|
@@ -1819,7 +1819,7 @@ interface SceneFlexItemRenderProps$1<T> extends SceneComponentProps<T> {
|
|
|
1819
1819
|
declare class SceneFlexItem extends SceneObjectBase<SceneFlexItemState> {
|
|
1820
1820
|
static Component: typeof SceneFlexItemRenderer;
|
|
1821
1821
|
}
|
|
1822
|
-
declare function SceneFlexItemRenderer({ model, parentState }: SceneFlexItemRenderProps$1<SceneFlexItem>):
|
|
1822
|
+
declare function SceneFlexItemRenderer({ model, parentState }: SceneFlexItemRenderProps$1<SceneFlexItem>): JSX.Element;
|
|
1823
1823
|
|
|
1824
1824
|
interface SceneCSSGridLayoutState extends SceneObjectState, SceneCSSGridLayoutOptions {
|
|
1825
1825
|
children: Array<SceneCSSGridItem | SceneObject>;
|
|
@@ -1863,7 +1863,7 @@ declare class SceneCSSGridLayout extends SceneObjectBase<SceneCSSGridLayoutState
|
|
|
1863
1863
|
constructor(state: Partial<SceneCSSGridLayoutState>);
|
|
1864
1864
|
isDraggable(): boolean;
|
|
1865
1865
|
}
|
|
1866
|
-
declare function SceneCSSGridLayoutRenderer({ model }: SceneCSSGridItemRenderProps<SceneCSSGridLayout>):
|
|
1866
|
+
declare function SceneCSSGridLayoutRenderer({ model }: SceneCSSGridItemRenderProps<SceneCSSGridLayout>): JSX.Element;
|
|
1867
1867
|
interface SceneCSSGridItemPlacement {
|
|
1868
1868
|
/**
|
|
1869
1869
|
* True when the item should rendered but not visible.
|
|
@@ -1885,9 +1885,9 @@ interface SceneCSSGridItemRenderProps<T> extends SceneComponentProps<T> {
|
|
|
1885
1885
|
declare class SceneCSSGridItem extends SceneObjectBase<SceneCSSGridItemState> {
|
|
1886
1886
|
static Component: typeof SceneCSSGridItemRenderer;
|
|
1887
1887
|
}
|
|
1888
|
-
declare function SceneCSSGridItemRenderer({ model, parentState }: SceneCSSGridItemRenderProps<SceneCSSGridItem>):
|
|
1888
|
+
declare function SceneCSSGridItemRenderer({ model, parentState }: SceneCSSGridItemRenderProps<SceneCSSGridItem>): JSX.Element;
|
|
1889
1889
|
|
|
1890
|
-
declare function SceneGridLayoutRenderer({ model }: SceneComponentProps<SceneGridLayout>):
|
|
1890
|
+
declare function SceneGridLayoutRenderer({ model }: SceneComponentProps<SceneGridLayout>): JSX.Element;
|
|
1891
1891
|
|
|
1892
1892
|
interface SceneGridItemPlacement {
|
|
1893
1893
|
x?: number;
|
|
@@ -1923,7 +1923,7 @@ declare class SceneGridRow extends SceneObjectBase<SceneGridRowState> {
|
|
|
1923
1923
|
};
|
|
1924
1924
|
updateFromUrl(values: SceneObjectUrlValues): void;
|
|
1925
1925
|
}
|
|
1926
|
-
declare function SceneGridRowRenderer({ model }: SceneComponentProps<SceneGridRow>):
|
|
1926
|
+
declare function SceneGridRowRenderer({ model }: SceneComponentProps<SceneGridRow>): JSX.Element;
|
|
1927
1927
|
|
|
1928
1928
|
interface SceneGridLayoutState extends SceneObjectState {
|
|
1929
1929
|
/**
|
|
@@ -1982,9 +1982,9 @@ interface SceneGridItemState extends SceneGridItemStateLike {
|
|
|
1982
1982
|
declare class SceneGridItem extends SceneObjectBase<SceneGridItemState> implements SceneGridItemLike {
|
|
1983
1983
|
static Component: typeof SceneGridItemRenderer;
|
|
1984
1984
|
}
|
|
1985
|
-
declare function SceneGridItemRenderer({ model }: SceneComponentProps<SceneGridItem>):
|
|
1985
|
+
declare function SceneGridItemRenderer({ model }: SceneComponentProps<SceneGridItem>): JSX.Element;
|
|
1986
1986
|
|
|
1987
|
-
declare function SplitLayoutRenderer({ model }: SceneFlexItemRenderProps<SplitLayout>):
|
|
1987
|
+
declare function SplitLayoutRenderer({ model }: SceneFlexItemRenderProps<SplitLayout>): JSX.Element;
|
|
1988
1988
|
interface SceneFlexItemRenderProps<T> extends SceneComponentProps<T> {
|
|
1989
1989
|
parentState?: SceneFlexItemPlacement;
|
|
1990
1990
|
}
|
|
@@ -2084,7 +2084,7 @@ declare class SceneApp extends SceneObjectBase<SceneAppState> implements DataReq
|
|
|
2084
2084
|
enrichDataRequest(): {
|
|
2085
2085
|
app: string;
|
|
2086
2086
|
};
|
|
2087
|
-
static Component: ({ model }: SceneComponentProps<SceneApp>) =>
|
|
2087
|
+
static Component: ({ model }: SceneComponentProps<SceneApp>) => JSX.Element;
|
|
2088
2088
|
}
|
|
2089
2089
|
/**
|
|
2090
2090
|
* Caches the the resulting SceneApp returned by the factory function so that it's only called once during the lifetime of the browser tab
|
|
@@ -2107,13 +2107,13 @@ declare class SceneAppPage extends SceneObjectBase<SceneAppPageState> implements
|
|
|
2107
2107
|
interface SceneAppPageRendererProps extends SceneComponentProps<SceneAppPage> {
|
|
2108
2108
|
routeProps: RouteComponentProps;
|
|
2109
2109
|
}
|
|
2110
|
-
declare function SceneAppPageRenderer({ model, routeProps }: SceneAppPageRendererProps):
|
|
2110
|
+
declare function SceneAppPageRenderer({ model, routeProps }: SceneAppPageRendererProps): JSX.Element;
|
|
2111
2111
|
|
|
2112
2112
|
interface SceneReactObjectState<TProps = {}> extends SceneObjectState {
|
|
2113
2113
|
/**
|
|
2114
2114
|
* React component to render
|
|
2115
2115
|
*/
|
|
2116
|
-
component?:
|
|
2116
|
+
component?: React$1.ComponentType<TProps>;
|
|
2117
2117
|
/**
|
|
2118
2118
|
* Props to pass to the component
|
|
2119
2119
|
*/
|
|
@@ -2121,13 +2121,13 @@ interface SceneReactObjectState<TProps = {}> extends SceneObjectState {
|
|
|
2121
2121
|
/**
|
|
2122
2122
|
* Alternative to component and props is just to pass a React node
|
|
2123
2123
|
*/
|
|
2124
|
-
reactNode?:
|
|
2124
|
+
reactNode?: React$1.ReactNode;
|
|
2125
2125
|
}
|
|
2126
2126
|
/**
|
|
2127
2127
|
* A utility object that can be used to render any React component or ReactNode
|
|
2128
2128
|
*/
|
|
2129
2129
|
declare class SceneReactObject<TProps = {}> extends SceneObjectBase<SceneReactObjectState<TProps>> {
|
|
2130
|
-
static Component: ({ model }: SceneComponentProps<SceneReactObject>) =>
|
|
2130
|
+
static Component: ({ model }: SceneComponentProps<SceneReactObject>) => {};
|
|
2131
2131
|
}
|
|
2132
2132
|
|
|
2133
2133
|
type StandardFieldConfigInterface<T, C, Prefix extends string> = {
|
|
@@ -2442,7 +2442,7 @@ interface Props {
|
|
|
2442
2442
|
*
|
|
2443
2443
|
* This is only exported so that core dashboards can use it.
|
|
2444
2444
|
*/
|
|
2445
|
-
declare function SceneDebugger({ scene }: Props):
|
|
2445
|
+
declare function SceneDebugger({ scene }: Props): JSX.Element;
|
|
2446
2446
|
|
|
2447
2447
|
declare const sceneUtils: {
|
|
2448
2448
|
getUrlWithAppState: typeof getUrlWithAppState;
|
package/dist/index.js
CHANGED
|
@@ -421,11 +421,17 @@ function useSceneObjectState(model) {
|
|
|
421
421
|
const [_, setState] = React.useState(model.state);
|
|
422
422
|
const stateAtFirstRender = model.state;
|
|
423
423
|
React.useEffect(() => {
|
|
424
|
-
const
|
|
424
|
+
const unactivate = model.activate();
|
|
425
|
+
const s = model.subscribeToState((state) => {
|
|
426
|
+
setState(state);
|
|
427
|
+
});
|
|
425
428
|
if (model.state !== stateAtFirstRender) {
|
|
426
429
|
setState(model.state);
|
|
427
430
|
}
|
|
428
|
-
return () =>
|
|
431
|
+
return () => {
|
|
432
|
+
s.unsubscribe();
|
|
433
|
+
unactivate();
|
|
434
|
+
};
|
|
429
435
|
}, [model]);
|
|
430
436
|
return model.state;
|
|
431
437
|
}
|
|
@@ -5159,7 +5165,7 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5159
5165
|
filters: [],
|
|
5160
5166
|
datasource: null,
|
|
5161
5167
|
applyMode: "auto",
|
|
5162
|
-
filterExpression: (_b = state.filterExpression) != null ? _b : renderExpression(state)
|
|
5168
|
+
filterExpression: (_b = state.filterExpression) != null ? _b : renderExpression(state.expressionBuilder, state.filters)
|
|
5163
5169
|
}, state));
|
|
5164
5170
|
this._scopedVars = { __sceneObject: { value: this } };
|
|
5165
5171
|
this._dataSourceSrv = runtime.getDataSourceSrv();
|
|
@@ -5167,30 +5173,21 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5167
5173
|
if (this.state.applyMode === "auto") {
|
|
5168
5174
|
patchGetAdhocFilters(this);
|
|
5169
5175
|
}
|
|
5170
|
-
this.addActivationHandler(() => {
|
|
5171
|
-
this._subs.add(
|
|
5172
|
-
this.subscribeToState((newState, prevState) => {
|
|
5173
|
-
if (newState.filters !== prevState.filters) {
|
|
5174
|
-
this._updateFilterExpression(newState, true);
|
|
5175
|
-
}
|
|
5176
|
-
})
|
|
5177
|
-
);
|
|
5178
|
-
this._updateFilterExpression(this.state, false);
|
|
5179
|
-
});
|
|
5180
5176
|
}
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
if (expr === this.state.filterExpression) {
|
|
5187
|
-
return;
|
|
5177
|
+
setState(update) {
|
|
5178
|
+
let filterExpressionChanged = false;
|
|
5179
|
+
if (update.filters && update.filters !== this.state.filters && !update.filterExpression) {
|
|
5180
|
+
update.filterExpression = renderExpression(this.state.expressionBuilder, update.filters);
|
|
5181
|
+
filterExpressionChanged = update.filterExpression !== this.state.filterExpression;
|
|
5188
5182
|
}
|
|
5189
|
-
|
|
5190
|
-
if (
|
|
5183
|
+
super.setState(update);
|
|
5184
|
+
if (filterExpressionChanged) {
|
|
5191
5185
|
this.publishEvent(new SceneVariableValueChangedEvent(this), true);
|
|
5192
5186
|
}
|
|
5193
5187
|
}
|
|
5188
|
+
getValue() {
|
|
5189
|
+
return this.state.filterExpression;
|
|
5190
|
+
}
|
|
5194
5191
|
_updateFilter(filter, prop, value) {
|
|
5195
5192
|
if (value == null) {
|
|
5196
5193
|
return;
|
|
@@ -5293,9 +5290,8 @@ class AdHocFiltersVariable extends SceneObjectBase {
|
|
|
5293
5290
|
}
|
|
5294
5291
|
}
|
|
5295
5292
|
AdHocFiltersVariable.Component = AdHocFiltersVariableRenderer;
|
|
5296
|
-
function renderExpression(
|
|
5297
|
-
|
|
5298
|
-
return ((_a = state.expressionBuilder) != null ? _a : renderPrometheusLabelFilters)((_b = state.filters) != null ? _b : []);
|
|
5293
|
+
function renderExpression(builder, filters) {
|
|
5294
|
+
return (builder != null ? builder : renderPrometheusLabelFilters)(filters != null ? filters : []);
|
|
5299
5295
|
}
|
|
5300
5296
|
function AdHocFiltersVariableRenderer({ model }) {
|
|
5301
5297
|
const { filters, readOnly, addFilterButtonText } = model.useState();
|