@grafana/scenes 5.14.7 → 5.15.0--canary.845.11012035874.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,10 @@
1
1
  import { SceneObjectBase } from '../../../core/SceneObjectBase.js';
2
- import { DEFAULT_PANEL_SPAN } from './constants.js';
2
+ import { DEFAULT_PANEL_SPAN, GRID_COLUMN_COUNT } from './constants.js';
3
3
  import { isSceneGridRow } from './SceneGridItem.js';
4
4
  import { SceneGridLayoutRenderer } from './SceneGridLayoutRenderer.js';
5
5
  import { SceneGridRow } from './SceneGridRow.js';
6
6
  import { fitPanelsInHeight } from './utils.js';
7
+ import { interpolate } from '../../../core/sceneGraph/sceneGraph.js';
7
8
 
8
9
  var __defProp = Object.defineProperty;
9
10
  var __defProps = Object.defineProperties;
@@ -32,6 +33,7 @@ const _SceneGridLayout = class extends SceneObjectBase {
32
33
  this._skipOnLayoutChange = false;
33
34
  this._oldLayout = [];
34
35
  this._loadOldLayout = false;
36
+ this.savedLayout = void 0;
35
37
  this.onLayoutChange = (layout) => {
36
38
  if (this._skipOnLayoutChange) {
37
39
  this._skipOnLayoutChange = false;
@@ -240,7 +242,38 @@ const _SceneGridLayout = class extends SceneObjectBase {
240
242
  }
241
243
  buildGridLayout(width, height) {
242
244
  let cells = [];
243
- for (const child of this.state.children) {
245
+ const searchString = this.state.searchString;
246
+ const panelsPerRow = this.state.panelsPerRow;
247
+ let children = this.state.children;
248
+ if (searchString && searchString !== "" || panelsPerRow && Number.isInteger(panelsPerRow)) {
249
+ if (this.savedLayout === void 0) {
250
+ this.savedLayout = this.state.children.map((v) => v.clone());
251
+ }
252
+ const panelFilterInterpolated = interpolate(this, searchString).toLowerCase();
253
+ const filteredChildren = this.state.children.filter((v) => {
254
+ var _a, _b, _c, _d;
255
+ const panelTitleInterpolated = interpolate(v, (_b = (_a = v.state.body) == null ? void 0 : _a.state) == null ? void 0 : _b.title).toLowerCase();
256
+ return typeof ((_d = (_c = v.state.body) == null ? void 0 : _c.state) == null ? void 0 : _d.title) === "string" && panelTitleInterpolated.includes(panelFilterInterpolated);
257
+ });
258
+ this._skipOnLayoutChange = true;
259
+ const rowSize = typeof panelsPerRow === "number" && Number.isInteger(panelsPerRow) && panelsPerRow > 0 ? panelsPerRow : 2;
260
+ const panelWidth = GRID_COLUMN_COUNT / rowSize;
261
+ const panelHeight = 5;
262
+ return filteredChildren.map((child, i) => __spreadProps(__spreadValues({}, this.toGridCell(child)), {
263
+ x: i % rowSize * panelWidth,
264
+ y: Math.floor(i / rowSize) * panelHeight,
265
+ w: panelWidth,
266
+ h: panelHeight,
267
+ isResizable: false,
268
+ isDraggable: false
269
+ }));
270
+ } else if ((!searchString || searchString === "") && !panelsPerRow) {
271
+ if (this.savedLayout) {
272
+ children = this.savedLayout;
273
+ this.savedLayout = void 0;
274
+ }
275
+ }
276
+ for (const child of children) {
244
277
  cells.push(this.toGridCell(child));
245
278
  if (child instanceof SceneGridRow && !child.state.isCollapsed) {
246
279
  for (const rowChild of child.state.children) {
@@ -1 +1 @@
1
- {"version":3,"file":"SceneGridLayout.js","sources":["../../../../../src/components/layout/grid/SceneGridLayout.tsx"],"sourcesContent":["import ReactGridLayout from 'react-grid-layout';\n\nimport { SceneObjectBase } from '../../../core/SceneObjectBase';\nimport { SceneLayout, SceneObjectState } from '../../../core/types';\nimport { DEFAULT_PANEL_SPAN } from './constants';\nimport { isSceneGridRow } from './SceneGridItem';\nimport { SceneGridLayoutRenderer } from './SceneGridLayoutRenderer';\n\nimport { SceneGridRow } from './SceneGridRow';\nimport { SceneGridItemLike, SceneGridItemPlacement } from './types';\nimport { fitPanelsInHeight } from './utils';\n\ninterface SceneGridLayoutState extends SceneObjectState {\n /**\n * Turn on or off dragging for all items. Individual items can still disabled via isDraggable property\n **/\n isDraggable?: boolean;\n /** Enable or disable item resizing */\n isResizable?: boolean;\n isLazy?: boolean;\n /**\n * Fit panels to height of the grid. This will scale down the panels vertically to fit available height.\n * The row height is not changed, only the y position and height of the panels.\n * UNSAFE: This feature is experimental and it might change in the future.\n */\n UNSAFE_fitPanels?: boolean;\n children: SceneGridItemLike[];\n}\n\nexport class SceneGridLayout extends SceneObjectBase<SceneGridLayoutState> implements SceneLayout {\n public static Component = SceneGridLayoutRenderer;\n\n private _skipOnLayoutChange = false;\n private _oldLayout: ReactGridLayout.Layout[] = [];\n private _loadOldLayout = false;\n\n public constructor(state: SceneGridLayoutState) {\n super({\n ...state,\n children: sortChildrenByPosition(state.children),\n });\n }\n\n /**\n * SceneLayout interface. Used for example by VizPanelRenderer\n */\n public isDraggable(): boolean {\n return this.state.isDraggable ?? false;\n }\n\n public getDragClass() {\n return `grid-drag-handle-${this.state.key}`;\n }\n\n public getDragClassCancel() {\n return `grid-drag-cancel`;\n }\n\n public toggleRow(row: SceneGridRow) {\n const isCollapsed = row.state.isCollapsed;\n\n if (!isCollapsed) {\n row.setState({ isCollapsed: true });\n // To force re-render\n this.setState({});\n return;\n }\n\n const rowChildren = row.state.children;\n\n if (rowChildren.length === 0) {\n row.setState({ isCollapsed: false });\n this.setState({});\n return;\n }\n\n // Ok we are expanding row. We need to update row children y pos (incase they are incorrect) and push items below down\n // Code copied from DashboardModel toggleRow()\n\n const rowY = row.state.y!;\n const firstPanelYPos = rowChildren[0].state.y ?? rowY;\n const yDiff = firstPanelYPos - (rowY + 1);\n\n // y max will represent the bottom y pos after all panels have been added\n // needed to know home much panels below should be pushed down\n let yMax = rowY;\n\n for (const panel of rowChildren) {\n // set the y gridPos if it wasn't already set\n const newSize = { ...panel.state };\n newSize.y = newSize.y ?? rowY;\n // make sure y is adjusted (in case row moved while collapsed)\n newSize.y -= yDiff;\n\n if (newSize.y! !== panel.state.y!) {\n panel.setState(newSize);\n }\n\n // update insert post and y max\n yMax = Math.max(yMax, Number(newSize.y!) + Number(newSize.height!));\n }\n\n const pushDownAmount = yMax - rowY - 1;\n\n // push panels below down\n for (const child of this.state.children) {\n if (child.state.y! > rowY) {\n this.pushChildDown(child, pushDownAmount);\n }\n\n if (isSceneGridRow(child) && child !== row) {\n for (const rowChild of child.state.children) {\n if (rowChild.state.y! > rowY) {\n this.pushChildDown(rowChild, pushDownAmount);\n }\n }\n }\n }\n\n row.setState({ isCollapsed: false });\n // Trigger re-render\n this.setState({});\n }\n\n public ignoreLayoutChange(shouldIgnore: boolean) {\n this._skipOnLayoutChange = shouldIgnore;\n }\n\n public onLayoutChange = (layout: ReactGridLayout.Layout[]) => {\n if (this._skipOnLayoutChange) {\n // Layout has been updated by other RTL handler already\n this._skipOnLayoutChange = false;\n return;\n }\n\n // We replace with the old layout only if the current state is invalid\n if (this._loadOldLayout) {\n layout = [...this._oldLayout];\n this._loadOldLayout = false;\n }\n\n for (const item of layout) {\n const child = this.getSceneLayoutChild(item.i);\n\n const nextSize: SceneGridItemPlacement = {\n x: item.x,\n y: item.y,\n width: item.w,\n height: item.h,\n };\n\n if (!isItemSizeEqual(child.state, nextSize)) {\n child.setState({\n ...nextSize,\n });\n }\n }\n\n this.setState({ children: sortChildrenByPosition(this.state.children) });\n };\n\n /**\n * Will also scan row children and return child of the row\n */\n public getSceneLayoutChild(key: string): SceneGridItemLike {\n for (const child of this.state.children) {\n if (child.state.key === key) {\n return child;\n }\n\n if (child instanceof SceneGridRow) {\n for (const rowChild of child.state.children) {\n if (rowChild.state.key === key) {\n return rowChild;\n }\n }\n }\n }\n\n throw new Error('Scene layout child not found for GridItem');\n }\n\n public onResizeStop: ReactGridLayout.ItemCallback = (_, o, n) => {\n const child = this.getSceneLayoutChild(n.i);\n child.setState({\n width: n.w,\n height: n.h,\n });\n };\n\n private pushChildDown(child: SceneGridItemLike, amount: number) {\n child.setState({\n y: child.state.y! + amount,\n });\n }\n\n /**\n * We assume the layout array is sorted according to y pos, and walk upwards until we find a row.\n * If it is collapsed there is no row to add it to. The default is then to return the SceneGridLayout itself\n */\n private findGridItemSceneParent(layout: ReactGridLayout.Layout[], startAt: number): SceneGridRow | SceneGridLayout {\n for (let i = startAt; i >= 0; i--) {\n const gridItem = layout[i];\n const sceneChild = this.getSceneLayoutChild(gridItem.i);\n\n if (sceneChild instanceof SceneGridRow) {\n // the closest row is collapsed return null\n if (sceneChild.state.isCollapsed) {\n return this;\n }\n\n return sceneChild;\n }\n }\n\n return this;\n }\n\n /**\n * Helper func to check if we are dropping a row in between panels of another row\n */\n private isRowDropValid(\n gridLayout: ReactGridLayout.Layout[],\n updatedItem: ReactGridLayout.Layout,\n indexOfUpdatedItem: number\n ): boolean {\n // if the row is dropped at the end of the dashboard grid layout, we accept this valid state\n if (gridLayout[gridLayout.length - 1].i === updatedItem.i) {\n return true;\n }\n\n // if the next child after the updated item is a scene grid row, then we are either at the top\n // of the dashboard, or between rows\n // if it's not a grid row, but it's parent is the layout, it means we are not in between a\n // rows children, so also valid state\n const nextSceneChild = this.getSceneLayoutChild(gridLayout[indexOfUpdatedItem + 1].i);\n if (nextSceneChild instanceof SceneGridRow) {\n return true;\n } else if (nextSceneChild.parent instanceof SceneGridLayout) {\n return true;\n }\n\n return false;\n }\n\n /**\n * This likely needs a slightly different approach. Where we clone or deactivate or and re-activate the moved child\n */\n public moveChildTo(child: SceneGridItemLike, target: SceneGridLayout | SceneGridRow) {\n const currentParent = child.parent!;\n let rootChildren = this.state.children;\n\n const newChild = child.clone({ key: child.state.key });\n\n // Remove from current parent row\n if (currentParent instanceof SceneGridRow) {\n const newRow = currentParent.clone();\n newRow.setState({\n children: newRow.state.children.filter((c) => c.state.key !== child.state.key),\n });\n\n // new children with new row\n rootChildren = rootChildren.map((c) => (c === currentParent ? newRow : c));\n\n // if target is also a row\n if (target instanceof SceneGridRow) {\n const targetRow = target.clone();\n targetRow.setState({ children: [...targetRow.state.children, newChild] });\n rootChildren = rootChildren.map((c) => (c === target ? targetRow : c));\n } else {\n // target is the main grid\n rootChildren = [...rootChildren, newChild];\n }\n } else {\n if (!(target instanceof SceneGridLayout)) {\n // current parent is the main grid remove it from there\n rootChildren = rootChildren.filter((c) => c.state.key !== child.state.key);\n // Clone the target row and add the child\n const targetRow = target.clone();\n targetRow.setState({ children: [...targetRow.state.children, newChild] });\n // Replace row with new row\n rootChildren = rootChildren.map((c) => (c === target ? targetRow : c));\n }\n }\n\n return rootChildren;\n }\n\n public onDragStart: ReactGridLayout.ItemCallback = (gridLayout) => {\n this._oldLayout = [...gridLayout];\n };\n\n public onDragStop: ReactGridLayout.ItemCallback = (gridLayout, o, updatedItem) => {\n const sceneChild = this.getSceneLayoutChild(updatedItem.i)!;\n\n // Need to resort the grid layout based on new position (needed to find the new parent)\n gridLayout = sortGridLayout(gridLayout);\n\n // Update children positions if they have changed\n for (let i = 0; i < gridLayout.length; i++) {\n const gridItem = gridLayout[i];\n const child = this.getSceneLayoutChild(gridItem.i)!;\n const childSize = child.state;\n\n if (childSize?.x !== gridItem.x || childSize?.y !== gridItem.y) {\n child.setState({\n x: gridItem.x,\n y: gridItem.y,\n });\n }\n }\n\n // Update the parent if the child if it has moved to a row or back to the grid\n const indexOfUpdatedItem = gridLayout.findIndex((item) => item.i === updatedItem.i);\n let newParent = this.findGridItemSceneParent(gridLayout, indexOfUpdatedItem - 1);\n let newChildren = this.state.children;\n\n // if the child is a row and we are moving it under an uncollapsed row, keep the scene grid layout as parent\n // and set the old layout flag if the state is invalid. We allow setting the children in an invalid state,\n // as the layout will be updated in onLayoutChange and avoid flickering\n if (sceneChild instanceof SceneGridRow && newParent instanceof SceneGridRow) {\n if (!this.isRowDropValid(gridLayout, updatedItem, indexOfUpdatedItem)) {\n this._loadOldLayout = true;\n }\n\n newParent = this;\n }\n\n if (newParent !== sceneChild.parent) {\n newChildren = this.moveChildTo(sceneChild, newParent);\n }\n\n this.setState({ children: sortChildrenByPosition(newChildren) });\n this._skipOnLayoutChange = true;\n };\n\n private toGridCell(child: SceneGridItemLike): ReactGridLayout.Layout {\n const size = child.state;\n\n let x = size.x ?? 0;\n let y = size.y ?? 0;\n const w = Number.isInteger(Number(size.width)) ? Number(size.width) : DEFAULT_PANEL_SPAN;\n const h = Number.isInteger(Number(size.height)) ? Number(size.height) : DEFAULT_PANEL_SPAN;\n\n let isDraggable = child.state.isDraggable;\n let isResizable = child.state.isResizable;\n\n if (child instanceof SceneGridRow) {\n isDraggable = child.state.isCollapsed ? true : false;\n isResizable = false;\n }\n\n return { i: child.state.key!, x, y, h, w, isResizable, isDraggable };\n }\n\n public buildGridLayout(width: number, height: number): ReactGridLayout.Layout[] {\n let cells: ReactGridLayout.Layout[] = [];\n\n for (const child of this.state.children) {\n cells.push(this.toGridCell(child));\n\n if (child instanceof SceneGridRow && !child.state.isCollapsed) {\n for (const rowChild of child.state.children) {\n cells.push(this.toGridCell(rowChild));\n }\n }\n }\n\n // Sort by position\n cells = sortGridLayout(cells);\n\n if (this.state.UNSAFE_fitPanels) {\n cells = fitPanelsInHeight(cells, height);\n }\n\n if (width < 768) {\n // We should not persist the mobile layout\n this._skipOnLayoutChange = true;\n return cells.map((cell) => ({ ...cell, w: 24 }));\n }\n\n this._skipOnLayoutChange = false;\n\n return cells;\n }\n}\n\nfunction isItemSizeEqual(a: SceneGridItemPlacement, b: SceneGridItemPlacement) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\nfunction sortChildrenByPosition(children: SceneGridItemLike[]) {\n children.forEach((child) => {\n if (child instanceof SceneGridRow) {\n child.setState({ children: sortChildrenByPosition(child.state.children) });\n }\n });\n\n return [...children].sort((a, b) => {\n return a.state.y! - b.state.y! || a.state.x! - b.state.x!;\n });\n}\n\nfunction sortGridLayout(layout: ReactGridLayout.Layout[]) {\n return [...layout].sort((a, b) => a.y - b.y || a.x! - b.x);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,gBAAA,GAAN,cAA8B,eAA6D,CAAA;AAAA,EAOzF,YAAY,KAA6B,EAAA;AAC9C,IAAA,KAAA,CAAM,iCACD,KADC,CAAA,EAAA;AAAA,MAEJ,QAAA,EAAU,sBAAuB,CAAA,KAAA,CAAM,QAAQ,CAAA;AAAA,KAChD,CAAA,CAAA,CAAA;AARH,I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;AAAA,GACxD,CAAA,CAAA;AACH,CAAA;AAEA,SAAS,eAAe,MAAkC,EAAA;AACxD,EAAA,OAAO,CAAC,GAAG,MAAM,CAAA,CAAE,KAAK,CAAC,CAAA,EAAG,CAAM,KAAA,CAAA,CAAE,IAAI,CAAE,CAAA,CAAA,IAAK,CAAE,CAAA,CAAA,GAAK,EAAE,CAAC,CAAA,CAAA;AAC3D;;;;"}
1
+ {"version":3,"file":"SceneGridLayout.js","sources":["../../../../../src/components/layout/grid/SceneGridLayout.tsx"],"sourcesContent":["import ReactGridLayout from 'react-grid-layout';\n\nimport { SceneObjectBase } from '../../../core/SceneObjectBase';\nimport { SceneLayout, SceneObjectState } from '../../../core/types';\nimport { DEFAULT_PANEL_SPAN, GRID_COLUMN_COUNT } from './constants';\nimport { isSceneGridRow } from './SceneGridItem';\nimport { SceneGridLayoutRenderer } from './SceneGridLayoutRenderer';\n\nimport { SceneGridRow } from './SceneGridRow';\nimport { SceneGridItemLike, SceneGridItemPlacement } from './types';\nimport { fitPanelsInHeight } from './utils';\nimport { interpolate } from '../../../core/sceneGraph/sceneGraph';\n\ninterface SceneGridLayoutState extends SceneObjectState {\n /**\n * Turn on or off dragging for all items. Individual items can still disabled via isDraggable property\n **/\n isDraggable?: boolean;\n /** Enable or disable item resizing */\n isResizable?: boolean;\n isLazy?: boolean;\n\n /** Panel search */\n showPanelSearch?: boolean;\n searchString?: string;\n panelsPerRow?: number;\n\n /**\n * Fit panels to height of the grid. This will scale down the panels vertically to fit available height.\n * The row height is not changed, only the y position and height of the panels.\n * UNSAFE: This feature is experimental and it might change in the future.\n */\n UNSAFE_fitPanels?: boolean;\n children: SceneGridItemLike[];\n}\n\nexport class SceneGridLayout extends SceneObjectBase<SceneGridLayoutState> implements SceneLayout {\n public static Component = SceneGridLayoutRenderer;\n\n private _skipOnLayoutChange = false;\n private _oldLayout: ReactGridLayout.Layout[] = [];\n private _loadOldLayout = false;\n\n private savedLayout: SceneGridItemLike[] | undefined = undefined;\n\n public constructor(state: SceneGridLayoutState) {\n super({\n ...state,\n children: sortChildrenByPosition(state.children),\n });\n }\n\n /**\n * SceneLayout interface. Used for example by VizPanelRenderer\n */\n public isDraggable(): boolean {\n return this.state.isDraggable ?? false;\n }\n\n public getDragClass() {\n return `grid-drag-handle-${this.state.key}`;\n }\n\n public getDragClassCancel() {\n return `grid-drag-cancel`;\n }\n\n public toggleRow(row: SceneGridRow) {\n const isCollapsed = row.state.isCollapsed;\n\n if (!isCollapsed) {\n row.setState({ isCollapsed: true });\n // To force re-render\n this.setState({});\n return;\n }\n\n const rowChildren = row.state.children;\n\n if (rowChildren.length === 0) {\n row.setState({ isCollapsed: false });\n this.setState({});\n return;\n }\n\n // Ok we are expanding row. We need to update row children y pos (incase they are incorrect) and push items below down\n // Code copied from DashboardModel toggleRow()\n\n const rowY = row.state.y!;\n const firstPanelYPos = rowChildren[0].state.y ?? rowY;\n const yDiff = firstPanelYPos - (rowY + 1);\n\n // y max will represent the bottom y pos after all panels have been added\n // needed to know home much panels below should be pushed down\n let yMax = rowY;\n\n for (const panel of rowChildren) {\n // set the y gridPos if it wasn't already set\n const newSize = { ...panel.state };\n newSize.y = newSize.y ?? rowY;\n // make sure y is adjusted (in case row moved while collapsed)\n newSize.y -= yDiff;\n\n if (newSize.y! !== panel.state.y!) {\n panel.setState(newSize);\n }\n\n // update insert post and y max\n yMax = Math.max(yMax, Number(newSize.y!) + Number(newSize.height!));\n }\n\n const pushDownAmount = yMax - rowY - 1;\n\n // push panels below down\n for (const child of this.state.children) {\n if (child.state.y! > rowY) {\n this.pushChildDown(child, pushDownAmount);\n }\n\n if (isSceneGridRow(child) && child !== row) {\n for (const rowChild of child.state.children) {\n if (rowChild.state.y! > rowY) {\n this.pushChildDown(rowChild, pushDownAmount);\n }\n }\n }\n }\n\n row.setState({ isCollapsed: false });\n // Trigger re-render\n this.setState({});\n }\n\n public ignoreLayoutChange(shouldIgnore: boolean) {\n this._skipOnLayoutChange = shouldIgnore;\n }\n\n public onLayoutChange = (layout: ReactGridLayout.Layout[]) => {\n if (this._skipOnLayoutChange) {\n // Layout has been updated by other RTL handler already\n this._skipOnLayoutChange = false;\n return;\n }\n\n // We replace with the old layout only if the current state is invalid\n if (this._loadOldLayout) {\n layout = [...this._oldLayout];\n this._loadOldLayout = false;\n }\n\n for (const item of layout) {\n const child = this.getSceneLayoutChild(item.i);\n\n const nextSize: SceneGridItemPlacement = {\n x: item.x,\n y: item.y,\n width: item.w,\n height: item.h,\n };\n\n if (!isItemSizeEqual(child.state, nextSize)) {\n child.setState({\n ...nextSize,\n });\n }\n }\n\n this.setState({ children: sortChildrenByPosition(this.state.children) });\n };\n\n /**\n * Will also scan row children and return child of the row\n */\n public getSceneLayoutChild(key: string): SceneGridItemLike {\n for (const child of this.state.children) {\n if (child.state.key === key) {\n return child;\n }\n\n if (child instanceof SceneGridRow) {\n for (const rowChild of child.state.children) {\n if (rowChild.state.key === key) {\n return rowChild;\n }\n }\n }\n }\n\n throw new Error('Scene layout child not found for GridItem');\n }\n\n public onResizeStop: ReactGridLayout.ItemCallback = (_, o, n) => {\n const child = this.getSceneLayoutChild(n.i);\n child.setState({\n width: n.w,\n height: n.h,\n });\n };\n\n private pushChildDown(child: SceneGridItemLike, amount: number) {\n child.setState({\n y: child.state.y! + amount,\n });\n }\n\n /**\n * We assume the layout array is sorted according to y pos, and walk upwards until we find a row.\n * If it is collapsed there is no row to add it to. The default is then to return the SceneGridLayout itself\n */\n private findGridItemSceneParent(layout: ReactGridLayout.Layout[], startAt: number): SceneGridRow | SceneGridLayout {\n for (let i = startAt; i >= 0; i--) {\n const gridItem = layout[i];\n const sceneChild = this.getSceneLayoutChild(gridItem.i);\n\n if (sceneChild instanceof SceneGridRow) {\n // the closest row is collapsed return null\n if (sceneChild.state.isCollapsed) {\n return this;\n }\n\n return sceneChild;\n }\n }\n\n return this;\n }\n\n /**\n * Helper func to check if we are dropping a row in between panels of another row\n */\n private isRowDropValid(\n gridLayout: ReactGridLayout.Layout[],\n updatedItem: ReactGridLayout.Layout,\n indexOfUpdatedItem: number\n ): boolean {\n // if the row is dropped at the end of the dashboard grid layout, we accept this valid state\n if (gridLayout[gridLayout.length - 1].i === updatedItem.i) {\n return true;\n }\n\n // if the next child after the updated item is a scene grid row, then we are either at the top\n // of the dashboard, or between rows\n // if it's not a grid row, but it's parent is the layout, it means we are not in between a\n // rows children, so also valid state\n const nextSceneChild = this.getSceneLayoutChild(gridLayout[indexOfUpdatedItem + 1].i);\n if (nextSceneChild instanceof SceneGridRow) {\n return true;\n } else if (nextSceneChild.parent instanceof SceneGridLayout) {\n return true;\n }\n\n return false;\n }\n\n /**\n * This likely needs a slightly different approach. Where we clone or deactivate or and re-activate the moved child\n */\n public moveChildTo(child: SceneGridItemLike, target: SceneGridLayout | SceneGridRow) {\n const currentParent = child.parent!;\n let rootChildren = this.state.children;\n\n const newChild = child.clone({ key: child.state.key });\n\n // Remove from current parent row\n if (currentParent instanceof SceneGridRow) {\n const newRow = currentParent.clone();\n newRow.setState({\n children: newRow.state.children.filter((c) => c.state.key !== child.state.key),\n });\n\n // new children with new row\n rootChildren = rootChildren.map((c) => (c === currentParent ? newRow : c));\n\n // if target is also a row\n if (target instanceof SceneGridRow) {\n const targetRow = target.clone();\n targetRow.setState({ children: [...targetRow.state.children, newChild] });\n rootChildren = rootChildren.map((c) => (c === target ? targetRow : c));\n } else {\n // target is the main grid\n rootChildren = [...rootChildren, newChild];\n }\n } else {\n if (!(target instanceof SceneGridLayout)) {\n // current parent is the main grid remove it from there\n rootChildren = rootChildren.filter((c) => c.state.key !== child.state.key);\n // Clone the target row and add the child\n const targetRow = target.clone();\n targetRow.setState({ children: [...targetRow.state.children, newChild] });\n // Replace row with new row\n rootChildren = rootChildren.map((c) => (c === target ? targetRow : c));\n }\n }\n\n return rootChildren;\n }\n\n public onDragStart: ReactGridLayout.ItemCallback = (gridLayout) => {\n this._oldLayout = [...gridLayout];\n };\n\n public onDragStop: ReactGridLayout.ItemCallback = (gridLayout, o, updatedItem) => {\n const sceneChild = this.getSceneLayoutChild(updatedItem.i)!;\n\n // Need to resort the grid layout based on new position (needed to find the new parent)\n gridLayout = sortGridLayout(gridLayout);\n\n // Update children positions if they have changed\n for (let i = 0; i < gridLayout.length; i++) {\n const gridItem = gridLayout[i];\n const child = this.getSceneLayoutChild(gridItem.i)!;\n const childSize = child.state;\n\n if (childSize?.x !== gridItem.x || childSize?.y !== gridItem.y) {\n child.setState({\n x: gridItem.x,\n y: gridItem.y,\n });\n }\n }\n\n // Update the parent if the child if it has moved to a row or back to the grid\n const indexOfUpdatedItem = gridLayout.findIndex((item) => item.i === updatedItem.i);\n let newParent = this.findGridItemSceneParent(gridLayout, indexOfUpdatedItem - 1);\n let newChildren = this.state.children;\n\n // if the child is a row and we are moving it under an uncollapsed row, keep the scene grid layout as parent\n // and set the old layout flag if the state is invalid. We allow setting the children in an invalid state,\n // as the layout will be updated in onLayoutChange and avoid flickering\n if (sceneChild instanceof SceneGridRow && newParent instanceof SceneGridRow) {\n if (!this.isRowDropValid(gridLayout, updatedItem, indexOfUpdatedItem)) {\n this._loadOldLayout = true;\n }\n\n newParent = this;\n }\n\n if (newParent !== sceneChild.parent) {\n newChildren = this.moveChildTo(sceneChild, newParent);\n }\n\n this.setState({ children: sortChildrenByPosition(newChildren) });\n this._skipOnLayoutChange = true;\n };\n\n private toGridCell(child: SceneGridItemLike): ReactGridLayout.Layout {\n const size = child.state;\n\n let x = size.x ?? 0;\n let y = size.y ?? 0;\n const w = Number.isInteger(Number(size.width)) ? Number(size.width) : DEFAULT_PANEL_SPAN;\n const h = Number.isInteger(Number(size.height)) ? Number(size.height) : DEFAULT_PANEL_SPAN;\n\n let isDraggable = child.state.isDraggable;\n let isResizable = child.state.isResizable;\n\n if (child instanceof SceneGridRow) {\n isDraggable = child.state.isCollapsed ? true : false;\n isResizable = false;\n }\n\n return { i: child.state.key!, x, y, h, w, isResizable, isDraggable };\n }\n\n public buildGridLayout(width: number, height: number): ReactGridLayout.Layout[] {\n let cells: ReactGridLayout.Layout[] = [];\n const searchString = this.state.searchString;\n const panelsPerRow = this.state.panelsPerRow;\n\n let children = this.state.children;\n if ((searchString && searchString !== '') || (panelsPerRow && Number.isInteger(panelsPerRow))) {\n if (this.savedLayout === undefined) {\n this.savedLayout = this.state.children.map((v) => v.clone());\n }\n\n const panelFilterInterpolated = interpolate(this, searchString).toLowerCase();\n const filteredChildren = this.state.children.filter((v) => {\n const panelTitleInterpolated = interpolate(v, (v.state as any).body?.state?.title).toLowerCase();\n return (\n typeof (v.state as any).body?.state?.title === 'string' &&\n panelTitleInterpolated.includes(panelFilterInterpolated)\n );\n });\n this._skipOnLayoutChange = true;\n const rowSize =\n typeof panelsPerRow === 'number' && Number.isInteger(panelsPerRow) && panelsPerRow > 0 ? panelsPerRow : 2;\n const panelWidth = GRID_COLUMN_COUNT / rowSize;\n const panelHeight = 5;\n return filteredChildren.map((child, i) => ({\n ...this.toGridCell(child),\n x: (i % rowSize) * panelWidth,\n y: Math.floor(i / rowSize) * panelHeight,\n w: panelWidth,\n h: panelHeight,\n isResizable: false,\n isDraggable: false,\n }));\n } else if ((!searchString || searchString === '') && !panelsPerRow) {\n if (this.savedLayout) {\n children = this.savedLayout;\n this.savedLayout = undefined;\n }\n }\n\n for (const child of children) {\n cells.push(this.toGridCell(child));\n\n if (child instanceof SceneGridRow && !child.state.isCollapsed) {\n for (const rowChild of child.state.children) {\n cells.push(this.toGridCell(rowChild));\n }\n }\n }\n\n // Sort by position\n cells = sortGridLayout(cells);\n\n if (this.state.UNSAFE_fitPanels) {\n cells = fitPanelsInHeight(cells, height);\n }\n\n if (width < 768) {\n // We should not persist the mobile layout\n this._skipOnLayoutChange = true;\n return cells.map((cell) => ({ ...cell, w: 24 }));\n }\n\n this._skipOnLayoutChange = false;\n\n return cells;\n }\n}\n\nfunction isItemSizeEqual(a: SceneGridItemPlacement, b: SceneGridItemPlacement) {\n return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\n\nfunction sortChildrenByPosition(children: SceneGridItemLike[]) {\n children.forEach((child) => {\n if (child instanceof SceneGridRow) {\n child.setState({ children: sortChildrenByPosition(child.state.children) });\n }\n });\n\n return [...children].sort((a, b) => {\n return a.state.y! - b.state.y! || a.state.x! - b.state.x!;\n });\n}\n\nfunction sortGridLayout(layout: ReactGridLayout.Layout[]) {\n return [...layout].sort((a, b) => a.y - b.y || a.x! - b.x);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCO,MAAM,gBAAA,GAAN,cAA8B,eAA6D,CAAA;AAAA,EASzF,YAAY,KAA6B,EAAA;AAC9C,IAAA,KAAA,CAAM,iCACD,KADC,CAAA,EAAA;AAAA,MAEJ,QAAA,EAAU,sBAAuB,CAAA,KAAA,CAAM,QAAQ,CAAA;AAAA,KAChD,CAAA,CAAA,CAAA;AAVH,IAAA,IAAA,CAAQ,mBAAsB,GAAA,KAAA,CAAA;AAC9B,IAAA,IAAA,CAAQ,aAAuC,EAAC,CAAA;AAChD,IAAA,IAAA,CAAQ,cAAiB,GAAA,KAAA,CAAA;AAEzB,IAAA,IAAA,CAAQ,WAA+C,GAAA,KAAA,CAAA,CAAA;AA8FvD,IAAO,IAAA,CAAA,cAAA,GAAiB,CAAC,MAAqC,KAAA;AAC5D,MAAA,IAAI,KAAK,mBAAqB,EAAA;AAE5B,QAAA,IAAA,CAAK,mBAAsB,GAAA,KAAA,CAAA;AAC3B,QAAA,OAAA;AAAA,OACF;AAGA,MAAA,IAAI,KAAK,cAAgB,EAAA;AACvB,QAAS,MAAA,GAAA,CAAC,GAAG,IAAA,CAAK,UAAU,CAAA,CAAA;AAC5B,QAAA,IAAA,CAAK,cAAiB,GAAA,KAAA,CAAA;AAAA,OACxB;AAEA,MAAA,KAAA,MAAW,QAAQ,MAAQ,EAAA;AACzB,QAAA,MAAM,KAAQ,GAAA,IAAA,CAAK,mBAAoB,CAAA,IAAA,CAAK,CAAC,CAAA,CAAA;AAE7C,QAAA,MAAM,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,QAAA,CAAS,EAAE,QAAU,EAAA,sBAAA,CAAuB,MAAM,KAAM,CAAA,QAAQ,GAAG,CAAA,CAAA;AAAA,KAC3E;AAAA,GACD,CAAA,CAAA;AAED,EAAA,OAAO,CAAC,GAAG,QAAQ,EAAE,IAAK,CAAA,CAAC,GAAG,CAAM,KAAA;AAClC,IAAO,OAAA,CAAA,CAAE,KAAM,CAAA,CAAA,GAAK,CAAE,CAAA,KAAA,CAAM,KAAM,CAAE,CAAA,KAAA,CAAM,CAAK,GAAA,CAAA,CAAE,KAAM,CAAA,CAAA,CAAA;AAAA,GACxD,CAAA,CAAA;AACH,CAAA;AAEA,SAAS,eAAe,MAAkC,EAAA;AACxD,EAAA,OAAO,CAAC,GAAG,MAAM,CAAA,CAAE,KAAK,CAAC,CAAA,EAAG,CAAM,KAAA,CAAA,CAAE,IAAI,CAAE,CAAA,CAAA,IAAK,CAAE,CAAA,CAAA,GAAK,EAAE,CAAC,CAAA,CAAA;AAC3D;;;;"}
@@ -1,10 +1,11 @@
1
- import React, { useRef, useEffect } from 'react';
1
+ import React, { useRef, useEffect, useCallback } from 'react';
2
2
  import ReactGridLayout from 'react-grid-layout';
3
3
  import { GRID_CELL_VMARGIN, GRID_COLUMN_COUNT, GRID_CELL_HEIGHT } from './constants.js';
4
4
  import { LazyLoader } from '../LazyLoader.js';
5
- import { useStyles2 } from '@grafana/ui';
5
+ import { useStyles2, Input } from '@grafana/ui';
6
6
  import { cx, css } from '@emotion/css';
7
7
  import { useMeasure } from 'react-use';
8
+ import { ControlsLabel } from '../../../utils/ControlsLabel.js';
8
9
 
9
10
  var __defProp = Object.defineProperty;
10
11
  var __defProps = Object.defineProperties;
@@ -38,7 +39,7 @@ var __objRest = (source, exclude) => {
38
39
  return target;
39
40
  };
40
41
  function SceneGridLayoutRenderer({ model }) {
41
- const { children, isLazy, isDraggable, isResizable } = model.useState();
42
+ const { children, isLazy, isDraggable, isResizable, showPanelSearch } = model.useState();
42
43
  const [outerDivRef, { width, height }] = useMeasure();
43
44
  const ref = useRef(null);
44
45
  useEffect(() => {
@@ -84,7 +85,67 @@ function SceneGridLayoutRenderer({ model }) {
84
85
  return /* @__PURE__ */ React.createElement("div", {
85
86
  ref: outerDivRef,
86
87
  style: { flex: "1 1 auto", position: "relative", zIndex: 1, width: "100%" }
87
- }, renderGrid(width, height));
88
+ }, showPanelSearch && /* @__PURE__ */ React.createElement(PanelSearchControls, {
89
+ model
90
+ }), renderGrid(width, height));
91
+ }
92
+ function PanelSearchControls({ model }) {
93
+ const { searchString, panelsPerRow } = model.useState();
94
+ const styles = useStyles2(getPanelSearchStyles);
95
+ const onSearchStringChange = useCallback(
96
+ (e) => {
97
+ model.setState({ searchString: e.currentTarget.value });
98
+ },
99
+ [model]
100
+ );
101
+ const onPanelsPerRowChange = useCallback(
102
+ (e) => {
103
+ model.setState({ panelsPerRow: Number.parseInt(e.currentTarget.value, 10) });
104
+ },
105
+ [model]
106
+ );
107
+ return /* @__PURE__ */ React.createElement("div", {
108
+ className: styles.wrapper
109
+ }, /* @__PURE__ */ React.createElement("div", {
110
+ id: "panel-search",
111
+ className: styles.input
112
+ }, /* @__PURE__ */ React.createElement(ControlsLabel, {
113
+ isLoading: false,
114
+ label: "Panel search",
115
+ htmlFor: "panel-search-input"
116
+ }), /* @__PURE__ */ React.createElement(Input, {
117
+ id: "panel-search-input",
118
+ label: "Search",
119
+ placeholder: "Enter value",
120
+ value: searchString,
121
+ onChange: onSearchStringChange
122
+ })), /* @__PURE__ */ React.createElement("div", {
123
+ id: "panels-per-row",
124
+ className: styles.input
125
+ }, /* @__PURE__ */ React.createElement(ControlsLabel, {
126
+ isLoading: false,
127
+ label: "Panels per row",
128
+ htmlFor: "panels-per-row-input"
129
+ }), /* @__PURE__ */ React.createElement(Input, {
130
+ id: "panels-per-row-input",
131
+ type: "number",
132
+ placeholder: "Enter value",
133
+ label: "Panels per row",
134
+ value: panelsPerRow,
135
+ onChange: onPanelsPerRowChange
136
+ })));
137
+ }
138
+ function getPanelSearchStyles(theme) {
139
+ return {
140
+ wrapper: css({
141
+ display: "flex",
142
+ gap: theme.spacing(1),
143
+ marginBottom: theme.spacing(1)
144
+ }),
145
+ input: css({
146
+ display: "flex"
147
+ })
148
+ };
88
149
  }
89
150
  const GridItemWrapper = React.forwardRef((props, ref) => {
90
151
  var _b;
@@ -1 +1 @@
1
- {"version":3,"file":"SceneGridLayoutRenderer.js","sources":["../../../../../src/components/layout/grid/SceneGridLayoutRenderer.tsx"],"sourcesContent":["import React, { RefCallback, useEffect, useRef } from 'react';\nimport ReactGridLayout from 'react-grid-layout';\nimport { SceneComponentProps } from '../../../core/types';\nimport { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from './constants';\nimport { LazyLoader } from '../LazyLoader';\nimport { SceneGridLayout } from './SceneGridLayout';\nimport { SceneGridItemLike } from './types';\nimport { useStyles2 } from '@grafana/ui';\nimport { css, cx } from '@emotion/css';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useMeasure } from 'react-use';\n\nexport function SceneGridLayoutRenderer({ model }: SceneComponentProps<SceneGridLayout>) {\n const { children, isLazy, isDraggable, isResizable } = model.useState();\n const [outerDivRef, { width, height }] = useMeasure();\n const ref = useRef<HTMLDivElement | null>(null);\n\n /**\n * The class that enables drag animations needs to be added after mount otherwise panels move on mount to their set positions which is annoying\n */\n useEffect(() => {\n updateAnimationClass(ref, !!isDraggable);\n }, [isDraggable]);\n\n validateChildrenSize(children);\n\n const renderGrid = (width: number, height: number) => {\n if (!width || !height) {\n return null;\n }\n\n const layout = model.buildGridLayout(width, height);\n\n return (\n /**\n * The children is using a width of 100% so we need to guarantee that it is wrapped\n * in an element that has the calculated size given by the AutoSizer. The AutoSizer\n * has a width of 0 and will let its content overflow its div.\n */\n <div ref={ref} style={{ width: `${width}px`, height: '100%' }} className=\"react-grid-layout\">\n <ReactGridLayout\n width={width}\n /**\n Disable draggable if mobile device, solving an issue with unintentionally\n moving panels. https://github.com/grafana/grafana/issues/18497\n theme.breakpoints.md = 769\n */\n isDraggable={isDraggable && width > 768}\n isResizable={isResizable ?? false}\n containerPadding={[0, 0]}\n useCSSTransforms={true}\n margin={[GRID_CELL_VMARGIN, GRID_CELL_VMARGIN]}\n cols={GRID_COLUMN_COUNT}\n rowHeight={GRID_CELL_HEIGHT}\n draggableHandle={`.grid-drag-handle-${model.state.key}`}\n draggableCancel=\".grid-drag-cancel\"\n layout={layout}\n onDragStart={model.onDragStart}\n onDragStop={model.onDragStop}\n onResizeStop={model.onResizeStop}\n onLayoutChange={model.onLayoutChange}\n isBounded={false}\n resizeHandle={<ResizeHandle />}\n >\n {layout.map((gridItem, index) => (\n <GridItemWrapper\n key={gridItem.i}\n grid={model}\n layoutItem={gridItem}\n index={index}\n isLazy={isLazy}\n totalCount={layout.length}\n />\n ))}\n </ReactGridLayout>\n </div>\n );\n };\n\n return (\n <div\n ref={outerDivRef as RefCallback<HTMLDivElement>}\n style={{ flex: '1 1 auto', position: 'relative', zIndex: 1, width: '100%' }}\n >\n {renderGrid(width, height)}\n </div>\n );\n}\n\ninterface GridItemWrapperProps extends React.HTMLAttributes<HTMLDivElement> {\n grid: SceneGridLayout;\n layoutItem: ReactGridLayout.Layout;\n index: number;\n totalCount: number;\n isLazy?: boolean;\n}\n\nconst GridItemWrapper = React.forwardRef<HTMLDivElement, GridItemWrapperProps>((props, ref) => {\n const { grid, layoutItem, index, totalCount, isLazy, style, onLoad, onChange, children, ...divProps } = props;\n const sceneChild = grid.getSceneLayoutChild(layoutItem.i)!;\n const className = sceneChild.getClassName?.();\n\n const innerContent = <sceneChild.Component model={sceneChild} key={sceneChild.state.key} />;\n\n if (isLazy) {\n return (\n <LazyLoader\n {...divProps}\n key={sceneChild.state.key!}\n data-griditem-key={sceneChild.state.key}\n className={cx(className, props.className)}\n style={style}\n ref={ref}\n >\n {innerContent}\n {children}\n </LazyLoader>\n );\n }\n\n return (\n <div\n {...divProps}\n ref={ref}\n key={sceneChild.state.key}\n data-griditem-key={sceneChild.state.key}\n className={cx(className, props.className)}\n style={style}\n >\n {innerContent}\n {children}\n </div>\n );\n});\n\nGridItemWrapper.displayName = 'GridItemWrapper';\n\nfunction validateChildrenSize(children: SceneGridItemLike[]) {\n if (\n children.some(\n (c) =>\n c.state.height === undefined ||\n c.state.width === undefined ||\n c.state.x === undefined ||\n c.state.y === undefined\n )\n ) {\n throw new Error('All children must have a size specified');\n }\n}\n\nfunction updateAnimationClass(\n ref: React.MutableRefObject<HTMLDivElement | null>,\n isDraggable: boolean,\n retry?: boolean\n) {\n if (ref.current) {\n if (isDraggable) {\n ref.current.classList.add('react-grid-layout--enable-move-animations');\n } else {\n ref.current.classList.remove('react-grid-layout--enable-move-animations');\n }\n } else if (!retry) {\n setTimeout(() => updateAnimationClass(ref, isDraggable, true), 50);\n }\n}\n\ninterface ResizeHandleProps extends React.HTMLAttributes<HTMLDivElement> {\n handleAxis?: string;\n}\n\nconst ResizeHandle = React.forwardRef<HTMLDivElement, ResizeHandleProps>(({ handleAxis, ...divProps }, ref) => {\n const customCssClass = useStyles2(getResizeHandleStyles);\n\n return (\n <div ref={ref} {...divProps} className={`${customCssClass} scene-resize-handle`}>\n <svg width=\"16px\" height=\"16px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M21 15L15 21M21 8L8 21\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </div>\n );\n});\n\nResizeHandle.displayName = 'ResizeHandle';\n\nfunction getResizeHandleStyles(theme: GrafanaTheme2) {\n return css({\n position: 'absolute',\n bottom: 0,\n right: 0,\n zIndex: 999,\n padding: theme.spacing(1.5, 0, 0, 1.5),\n color: theme.colors.border.strong,\n cursor: 'se-resize',\n '&:hover': {\n color: theme.colors.text.link,\n },\n svg: {\n display: 'block',\n },\n '.react-resizable-hide &': {\n display: 'none',\n },\n });\n}\n"],"names":["width","height"],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AAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,IAAA;AAAA,KAC3B;AAAA,IACA,GAAK,EAAA;AAAA,MACH,OAAS,EAAA,OAAA;AAAA,KACX;AAAA,IACA,yBAA2B,EAAA;AAAA,MACzB,OAAS,EAAA,MAAA;AAAA,KACX;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"SceneGridLayoutRenderer.js","sources":["../../../../../src/components/layout/grid/SceneGridLayoutRenderer.tsx"],"sourcesContent":["import React, { RefCallback, useCallback, useEffect, useRef } from 'react';\nimport ReactGridLayout from 'react-grid-layout';\nimport { SceneComponentProps } from '../../../core/types';\nimport { GRID_CELL_HEIGHT, GRID_CELL_VMARGIN, GRID_COLUMN_COUNT } from './constants';\nimport { LazyLoader } from '../LazyLoader';\nimport { SceneGridLayout } from './SceneGridLayout';\nimport { SceneGridItemLike } from './types';\nimport { Input, useStyles2 } from '@grafana/ui';\nimport { css, cx } from '@emotion/css';\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { useMeasure } from 'react-use';\nimport { ControlsLabel } from '../../../utils/ControlsLabel';\n\nexport function SceneGridLayoutRenderer({ model }: SceneComponentProps<SceneGridLayout>) {\n const { children, isLazy, isDraggable, isResizable, showPanelSearch } = model.useState();\n const [outerDivRef, { width, height }] = useMeasure();\n const ref = useRef<HTMLDivElement | null>(null);\n\n /**\n * The class that enables drag animations needs to be added after mount otherwise panels move on mount to their set positions which is annoying\n */\n useEffect(() => {\n updateAnimationClass(ref, !!isDraggable);\n }, [isDraggable]);\n\n validateChildrenSize(children);\n\n const renderGrid = (width: number, height: number) => {\n if (!width || !height) {\n return null;\n }\n\n const layout = model.buildGridLayout(width, height);\n\n return (\n /**\n * The children is using a width of 100% so we need to guarantee that it is wrapped\n * in an element that has the calculated size given by the AutoSizer. The AutoSizer\n * has a width of 0 and will let its content overflow its div.\n */\n <div ref={ref} style={{ width: `${width}px`, height: '100%' }} className=\"react-grid-layout\">\n <ReactGridLayout\n width={width}\n /**\n Disable draggable if mobile device, solving an issue with unintentionally\n moving panels. https://github.com/grafana/grafana/issues/18497\n theme.breakpoints.md = 769\n */\n isDraggable={isDraggable && width > 768}\n isResizable={isResizable ?? false}\n containerPadding={[0, 0]}\n useCSSTransforms={true}\n margin={[GRID_CELL_VMARGIN, GRID_CELL_VMARGIN]}\n cols={GRID_COLUMN_COUNT}\n rowHeight={GRID_CELL_HEIGHT}\n draggableHandle={`.grid-drag-handle-${model.state.key}`}\n draggableCancel=\".grid-drag-cancel\"\n layout={layout}\n onDragStart={model.onDragStart}\n onDragStop={model.onDragStop}\n onResizeStop={model.onResizeStop}\n onLayoutChange={model.onLayoutChange}\n isBounded={false}\n resizeHandle={<ResizeHandle />}\n >\n {layout.map((gridItem, index) => (\n <GridItemWrapper\n key={gridItem.i}\n grid={model}\n layoutItem={gridItem}\n index={index}\n isLazy={isLazy}\n totalCount={layout.length}\n />\n ))}\n </ReactGridLayout>\n </div>\n );\n };\n\n return (\n <div\n ref={outerDivRef as RefCallback<HTMLDivElement>}\n style={{ flex: '1 1 auto', position: 'relative', zIndex: 1, width: '100%' }}\n >\n {showPanelSearch && <PanelSearchControls model={model} />}\n {renderGrid(width, height)}\n </div>\n );\n}\n\ninterface PanelSearchProps {\n model: SceneGridLayout;\n}\n\nfunction PanelSearchControls({ model }: PanelSearchProps) {\n const { searchString, panelsPerRow } = model.useState();\n const styles = useStyles2(getPanelSearchStyles);\n\n const onSearchStringChange = useCallback(\n (e: React.FormEvent<HTMLInputElement>) => {\n model.setState({ searchString: e.currentTarget.value });\n },\n [model]\n );\n\n const onPanelsPerRowChange = useCallback(\n (e: React.FormEvent<HTMLInputElement>) => {\n model.setState({ panelsPerRow: Number.parseInt(e.currentTarget.value, 10) });\n },\n [model]\n );\n\n return (\n <div className={styles.wrapper}>\n <div id=\"panel-search\" className={styles.input}>\n <ControlsLabel isLoading={false} label=\"Panel search\" htmlFor=\"panel-search-input\" />\n <Input\n id=\"panel-search-input\"\n label=\"Search\"\n placeholder=\"Enter value\"\n value={searchString}\n onChange={onSearchStringChange}\n />\n </div>\n <div id=\"panels-per-row\" className={styles.input}>\n <ControlsLabel isLoading={false} label=\"Panels per row\" htmlFor=\"panels-per-row-input\" />\n <Input\n id=\"panels-per-row-input\"\n type=\"number\"\n placeholder=\"Enter value\"\n label=\"Panels per row\"\n value={panelsPerRow}\n onChange={onPanelsPerRowChange}\n />\n </div>\n </div>\n );\n}\n\nfunction getPanelSearchStyles(theme: GrafanaTheme2) {\n return {\n wrapper: css({\n display: 'flex',\n gap: theme.spacing(1),\n marginBottom: theme.spacing(1),\n }),\n input: css({\n display: 'flex',\n })\n }\n}\n\ninterface GridItemWrapperProps extends React.HTMLAttributes<HTMLDivElement> {\n grid: SceneGridLayout;\n layoutItem: ReactGridLayout.Layout;\n index: number;\n totalCount: number;\n isLazy?: boolean;\n}\n\nconst GridItemWrapper = React.forwardRef<HTMLDivElement, GridItemWrapperProps>((props, ref) => {\n const { grid, layoutItem, index, totalCount, isLazy, style, onLoad, onChange, children, ...divProps } = props;\n const sceneChild = grid.getSceneLayoutChild(layoutItem.i)!;\n const className = sceneChild.getClassName?.();\n\n const innerContent = <sceneChild.Component model={sceneChild} key={sceneChild.state.key} />;\n\n if (isLazy) {\n return (\n <LazyLoader\n {...divProps}\n key={sceneChild.state.key!}\n data-griditem-key={sceneChild.state.key}\n className={cx(className, props.className)}\n style={style}\n ref={ref}\n >\n {innerContent}\n {children}\n </LazyLoader>\n );\n }\n\n return (\n <div\n {...divProps}\n ref={ref}\n key={sceneChild.state.key}\n data-griditem-key={sceneChild.state.key}\n className={cx(className, props.className)}\n style={style}\n >\n {innerContent}\n {children}\n </div>\n );\n});\n\nGridItemWrapper.displayName = 'GridItemWrapper';\n\nfunction validateChildrenSize(children: SceneGridItemLike[]) {\n if (\n children.some(\n (c) =>\n c.state.height === undefined ||\n c.state.width === undefined ||\n c.state.x === undefined ||\n c.state.y === undefined\n )\n ) {\n throw new Error('All children must have a size specified');\n }\n}\n\nfunction updateAnimationClass(\n ref: React.MutableRefObject<HTMLDivElement | null>,\n isDraggable: boolean,\n retry?: boolean\n) {\n if (ref.current) {\n if (isDraggable) {\n ref.current.classList.add('react-grid-layout--enable-move-animations');\n } else {\n ref.current.classList.remove('react-grid-layout--enable-move-animations');\n }\n } else if (!retry) {\n setTimeout(() => updateAnimationClass(ref, isDraggable, true), 50);\n }\n}\n\ninterface ResizeHandleProps extends React.HTMLAttributes<HTMLDivElement> {\n handleAxis?: string;\n}\n\nconst ResizeHandle = React.forwardRef<HTMLDivElement, ResizeHandleProps>(({ handleAxis, ...divProps }, ref) => {\n const customCssClass = useStyles2(getResizeHandleStyles);\n\n return (\n <div ref={ref} {...divProps} className={`${customCssClass} scene-resize-handle`}>\n <svg width=\"16px\" height=\"16px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M21 15L15 21M21 8L8 21\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n </div>\n );\n});\n\nResizeHandle.displayName = 'ResizeHandle';\n\nfunction getResizeHandleStyles(theme: GrafanaTheme2) {\n return css({\n position: 'absolute',\n bottom: 0,\n right: 0,\n zIndex: 999,\n padding: theme.spacing(1.5, 0, 0, 1.5),\n color: theme.colors.border.strong,\n cursor: 'se-resize',\n '&:hover': {\n color: theme.colors.text.link,\n },\n svg: {\n display: 'block',\n },\n '.react-resizable-hide &': {\n display: 'none',\n },\n });\n}\n"],"names":["width","height"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAagB,SAAA,uBAAA,CAAwB,EAAE,KAAA,EAA+C,EAAA;AACvF,EAAM,MAAA,EAAE,UAAU,MAAQ,EAAA,WAAA,EAAa,aAAa,eAAgB,EAAA,GAAI,MAAM,QAAS,EAAA,CAAA;AACvF,EAAA,MAAM,CAAC,WAAa,EAAA,EAAE,OAAO,M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AK,EAAA,MAAA;AAAA,IAAO,KAAM,EAAA,4BAAA;AAAA,GAAA,kBACnE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IACC,CAAE,EAAA,wBAAA;AAAA,IACF,MAAO,EAAA,cAAA;AAAA,IACP,WAAY,EAAA,GAAA;AAAA,IACZ,aAAc,EAAA,OAAA;AAAA,IACd,cAAe,EAAA,OAAA;AAAA,GACjB,CACF,CACF,CAAA,CAAA;AAEJ,CAAC,CAAA,CAAA;AAED,YAAA,CAAa,WAAc,GAAA,cAAA,CAAA;AAE3B,SAAS,sBAAsB,KAAsB,EAAA;AACnD,EAAA,OAAO,GAAI,CAAA;AAAA,IACT,QAAU,EAAA,UAAA;AAAA,IACV,MAAQ,EAAA,CAAA;AAAA,IACR,KAAO,EAAA,CAAA;AAAA,IACP,MAAQ,EAAA,GAAA;AAAA,IACR,SAAS,KAAM,CAAA,OAAA,CAAQ,GAAK,EAAA,CAAA,EAAG,GAAG,GAAG,CAAA;AAAA,IACrC,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,MAAO,CAAA,MAAA;AAAA,IAC3B,MAAQ,EAAA,WAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,IAAA;AAAA,KAC3B;AAAA,IACA,GAAK,EAAA;AAAA,MACH,OAAS,EAAA,OAAA;AAAA,KACX;AAAA,IACA,yBAA2B,EAAA;AAAA,MACzB,OAAS,EAAA,MAAA;AAAA,KACX;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
package/dist/esm/index.js CHANGED
@@ -19,6 +19,7 @@ export { SceneDataNode } from './core/SceneDataNode.js';
19
19
  export { SceneTimeRange } from './core/SceneTimeRange.js';
20
20
  export { SceneTimeZoneOverride } from './core/SceneTimeZoneOverride.js';
21
21
  export { SceneQueryRunner } from './querying/SceneQueryRunner.js';
22
+ export { DataProviderProxy } from './querying/DataProviderProxy.js';
22
23
  export { SceneDataLayerSet, SceneDataLayerSetBase } from './querying/SceneDataLayerSet.js';
23
24
  export { SceneDataLayerBase } from './querying/layers/SceneDataLayerBase.js';
24
25
  export { SceneDataLayerControls } from './querying/layers/SceneDataLayerControls.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { getUrlWithAppState } from './components/SceneApp/utils';\nimport { registerRuntimePanelPlugin } from './components/VizPanel/registerRuntimePanelPlugin';\nimport { cloneSceneObjectState } from './core/sceneGraph/utils';\nimport { registerRuntimeDataSource } from './querying/RuntimeDataSource';\nimport { getUrlState, syncStateFromSearchParams } from './services/utils';\n\nimport { registerVariableMacro } from './variables/macros';\nimport { renderPrometheusLabelFilters } from './variables/utils';\nimport {\n isAdHocVariable,\n isQueryVariable,\n isTextBoxVariable,\n isCustomVariable,\n isDataSourceVariable,\n isConstantVariable,\n isIntervalVariable,\n isGroupByVariable,\n} from './variables/variants/guards';\n\nexport * from './core/types';\nexport * from './core/events';\nexport { sceneGraph } from './core/sceneGraph';\nexport * as behaviors from './behaviors';\nexport * as dataLayers from './querying/layers';\n\nexport { SceneObjectBase, useSceneObjectState } from './core/SceneObjectBase';\nexport { SceneDataNode } from './core/SceneDataNode';\nexport { SceneTimeRange } from './core/SceneTimeRange';\nexport { SceneTimeZoneOverride } from './core/SceneTimeZoneOverride';\n\nexport { SceneQueryRunner, type QueryRunnerState } from './querying/SceneQueryRunner';\nexport {\n type ExtraQueryDescriptor,\n type ExtraQueryProvider,\n type ExtraQueryDataProcessor,\n} from './querying/ExtraQueryProvider';\nexport { SceneDataLayerSet, SceneDataLayerSetBase } from './querying/SceneDataLayerSet';\nexport { SceneDataLayerBase } from './querying/layers/SceneDataLayerBase';\nexport { SceneDataLayerControls } from './querying/layers/SceneDataLayerControls';\nexport { SceneDataTransformer, type SceneDataTransformerState } from './querying/SceneDataTransformer';\nexport { registerQueryWithController } from './querying/registerQueryWithController';\nexport { registerRuntimeDataSource, RuntimeDataSource } from './querying/RuntimeDataSource';\nexport type {\n SceneQueryControllerLike,\n SceneQueryControllerEntryType,\n SceneQueryControllerEntry,\n} from './behaviors/SceneQueryController';\n\nexport * from './variables/types';\nexport { VariableDependencyConfig } from './variables/VariableDependencyConfig';\nexport { formatRegistry, type FormatVariable } from './variables/interpolation/formatRegistry';\nexport { VariableValueSelectors } from './variables/components/VariableValueSelectors';\nexport { VariableValueControl } from './variables/components/VariableValueControl';\nexport { SceneVariableSet } from './variables/sets/SceneVariableSet';\nexport { ConstantVariable } from './variables/variants/ConstantVariable';\nexport { CustomVariable } from './variables/variants/CustomVariable';\nexport { DataSourceVariable } from './variables/variants/DataSourceVariable';\nexport { QueryVariable } from './variables/variants/query/QueryVariable';\nexport { TestVariable } from './variables/variants/TestVariable';\nexport { TextBoxVariable } from './variables/variants/TextBoxVariable';\nexport {\n MultiValueVariable,\n type MultiValueVariableState,\n type VariableGetOptionsArgs,\n} from './variables/variants/MultiValueVariable';\nexport { LocalValueVariable } from './variables/variants/LocalValueVariable';\nexport { IntervalVariable } from './variables/variants/IntervalVariable';\nexport { AdHocFiltersVariable } from './variables/adhoc/AdHocFiltersVariable';\nexport { GroupByVariable } from './variables/groupby/GroupByVariable';\nexport { type MacroVariableConstructor } from './variables/macros/types';\n\nexport { type UrlSyncManagerLike, UrlSyncManager, NewSceneObjectAddedEvent } from './services/UrlSyncManager';\nexport { useUrlSync } from './services/useUrlSync';\nexport { UrlSyncContextProvider } from './services/UrlSyncContextProvider';\nexport { SceneObjectUrlSyncConfig } from './services/SceneObjectUrlSyncConfig';\n\nexport { EmbeddedScene, type EmbeddedSceneState } from './components/EmbeddedScene';\nexport { VizPanel, type VizPanelState } from './components/VizPanel/VizPanel';\nexport { VizPanelMenu } from './components/VizPanel/VizPanelMenu';\nexport { NestedScene } from './components/NestedScene';\nexport { SceneCanvasText } from './components/SceneCanvasText';\nexport { SceneToolbarButton, SceneToolbarInput } from './components/SceneToolbarButton';\nexport { SceneTimePicker } from './components/SceneTimePicker';\nexport { SceneRefreshPicker, type SceneRefreshPickerState } from './components/SceneRefreshPicker';\nexport { SceneTimeRangeTransformerBase } from './core/SceneTimeRangeTransformerBase';\nexport { SceneTimeRangeCompare } from './components/SceneTimeRangeCompare';\nexport { SceneByFrameRepeater } from './components/SceneByFrameRepeater';\nexport { SceneByVariableRepeater } from './components/SceneByVariableRepeater';\nexport { SceneControlsSpacer } from './components/SceneControlsSpacer';\nexport {\n SceneFlexLayout,\n SceneFlexItem,\n type SceneFlexItemState,\n type SceneFlexItemLike,\n} from './components/layout/SceneFlexLayout';\nexport { SceneCSSGridLayout, SceneCSSGridItem } from './components/layout/CSSGrid/SceneCSSGridLayout';\nexport { SceneGridLayout } from './components/layout/grid/SceneGridLayout';\nexport { SceneGridItem } from './components/layout/grid/SceneGridItem';\nexport { SceneGridRow } from './components/layout/grid/SceneGridRow';\nexport { type SceneGridItemStateLike, type SceneGridItemLike } from './components/layout/grid/types';\nexport { SplitLayout } from './components/layout/split/SplitLayout';\nexport {\n type SceneAppPageLike,\n type SceneRouteMatch,\n type SceneAppPageState,\n type SceneAppDrilldownView,\n type SceneAppRoute,\n} from './components/SceneApp/types';\nexport { SceneApp, useSceneApp } from './components/SceneApp/SceneApp';\nexport { SceneAppPage } from './components/SceneApp/SceneAppPage';\nexport { SceneReactObject } from './components/SceneReactObject';\nexport { SceneObjectRef } from './core/SceneObjectRef';\nexport {\n PanelBuilders,\n PanelOptionsBuilders,\n FieldConfigBuilders,\n FieldConfigOverridesBuilder,\n} from './core/PanelBuilders';\nexport { FieldConfigBuilder } from './core/PanelBuilders/FieldConfigBuilder';\nexport { VizPanelBuilder } from './core/PanelBuilders/VizPanelBuilder';\nexport { SceneDebugger } from './components/SceneDebugger/SceneDebugger';\nexport { VariableValueSelectWrapper } from './variables/components/VariableValueSelectors';\nexport { renderSelectForVariable } from './variables/components/VariableValueSelect';\nexport { VizConfigBuilder } from './core/PanelBuilders/VizConfigBuilder';\nexport { VizConfigBuilders } from './core/PanelBuilders/VizConfigBuilders';\nexport { type VizConfig } from './core/PanelBuilders/types';\n\nexport const sceneUtils = {\n getUrlWithAppState,\n registerRuntimePanelPlugin,\n registerRuntimeDataSource,\n registerVariableMacro,\n cloneSceneObjectState,\n syncStateFromSearchParams,\n getUrlState,\n renderPrometheusLabelFilters,\n\n // Variable guards\n isAdHocVariable,\n isConstantVariable,\n isCustomVariable,\n isDataSourceVariable,\n isIntervalVariable,\n isQueryVariable,\n isTextBoxVariable,\n isGroupByVariable,\n};\n\nexport { SafeSerializableSceneObject } from './utils/SafeSerializableSceneObject';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+HO,MAAM,UAAa,GAAA;AAAA,EACxB,kBAAA;AAAA,EACA,0BAAA;AAAA,EACA,yBAAA;AAAA,EACA,qBAAA;AAAA,EACA,qBAAA;AAAA,EACA,yBAAA;AAAA,EACA,WAAA;AAAA,EACA,4BAAA;AAAA,EAGA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,gBAAA;AAAA,EACA,oBAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import { getUrlWithAppState } from './components/SceneApp/utils';\nimport { registerRuntimePanelPlugin } from './components/VizPanel/registerRuntimePanelPlugin';\nimport { cloneSceneObjectState } from './core/sceneGraph/utils';\nimport { registerRuntimeDataSource } from './querying/RuntimeDataSource';\nimport { getUrlState, syncStateFromSearchParams } from './services/utils';\n\nimport { registerVariableMacro } from './variables/macros';\nimport { renderPrometheusLabelFilters } from './variables/utils';\nimport {\n isAdHocVariable,\n isQueryVariable,\n isTextBoxVariable,\n isCustomVariable,\n isDataSourceVariable,\n isConstantVariable,\n isIntervalVariable,\n isGroupByVariable,\n} from './variables/variants/guards';\n\nexport * from './core/types';\nexport * from './core/events';\nexport { sceneGraph } from './core/sceneGraph';\nexport * as behaviors from './behaviors';\nexport * as dataLayers from './querying/layers';\n\nexport { SceneObjectBase, useSceneObjectState } from './core/SceneObjectBase';\nexport { SceneDataNode } from './core/SceneDataNode';\nexport { SceneTimeRange } from './core/SceneTimeRange';\nexport { SceneTimeZoneOverride } from './core/SceneTimeZoneOverride';\n\nexport { SceneQueryRunner, type QueryRunnerState } from './querying/SceneQueryRunner';\nexport { DataProviderProxy } from './querying/DataProviderProxy';\nexport {\n type ExtraQueryDescriptor,\n type ExtraQueryProvider,\n type ExtraQueryDataProcessor,\n} from './querying/ExtraQueryProvider';\nexport { SceneDataLayerSet, SceneDataLayerSetBase } from './querying/SceneDataLayerSet';\nexport { SceneDataLayerBase } from './querying/layers/SceneDataLayerBase';\nexport { SceneDataLayerControls } from './querying/layers/SceneDataLayerControls';\nexport { SceneDataTransformer, type SceneDataTransformerState } from './querying/SceneDataTransformer';\nexport { registerQueryWithController } from './querying/registerQueryWithController';\nexport { registerRuntimeDataSource, RuntimeDataSource } from './querying/RuntimeDataSource';\nexport type {\n SceneQueryControllerLike,\n SceneQueryControllerEntryType,\n SceneQueryControllerEntry,\n} from './behaviors/SceneQueryController';\n\nexport * from './variables/types';\nexport { VariableDependencyConfig } from './variables/VariableDependencyConfig';\nexport { formatRegistry, type FormatVariable } from './variables/interpolation/formatRegistry';\nexport { VariableValueSelectors } from './variables/components/VariableValueSelectors';\nexport { VariableValueControl } from './variables/components/VariableValueControl';\nexport { SceneVariableSet } from './variables/sets/SceneVariableSet';\nexport { ConstantVariable } from './variables/variants/ConstantVariable';\nexport { CustomVariable } from './variables/variants/CustomVariable';\nexport { DataSourceVariable } from './variables/variants/DataSourceVariable';\nexport { QueryVariable } from './variables/variants/query/QueryVariable';\nexport { TestVariable } from './variables/variants/TestVariable';\nexport { TextBoxVariable } from './variables/variants/TextBoxVariable';\nexport {\n MultiValueVariable,\n type MultiValueVariableState,\n type VariableGetOptionsArgs,\n} from './variables/variants/MultiValueVariable';\nexport { LocalValueVariable } from './variables/variants/LocalValueVariable';\nexport { IntervalVariable } from './variables/variants/IntervalVariable';\nexport { AdHocFiltersVariable } from './variables/adhoc/AdHocFiltersVariable';\nexport { GroupByVariable } from './variables/groupby/GroupByVariable';\nexport { type MacroVariableConstructor } from './variables/macros/types';\n\nexport { type UrlSyncManagerLike, UrlSyncManager, NewSceneObjectAddedEvent } from './services/UrlSyncManager';\nexport { useUrlSync } from './services/useUrlSync';\nexport { UrlSyncContextProvider } from './services/UrlSyncContextProvider';\nexport { SceneObjectUrlSyncConfig } from './services/SceneObjectUrlSyncConfig';\n\nexport { EmbeddedScene, type EmbeddedSceneState } from './components/EmbeddedScene';\nexport { VizPanel, type VizPanelState } from './components/VizPanel/VizPanel';\nexport { VizPanelMenu } from './components/VizPanel/VizPanelMenu';\nexport { NestedScene } from './components/NestedScene';\nexport { SceneCanvasText } from './components/SceneCanvasText';\nexport { SceneToolbarButton, SceneToolbarInput } from './components/SceneToolbarButton';\nexport { SceneTimePicker } from './components/SceneTimePicker';\nexport { SceneRefreshPicker, type SceneRefreshPickerState } from './components/SceneRefreshPicker';\nexport { SceneTimeRangeTransformerBase } from './core/SceneTimeRangeTransformerBase';\nexport { SceneTimeRangeCompare } from './components/SceneTimeRangeCompare';\nexport { SceneByFrameRepeater } from './components/SceneByFrameRepeater';\nexport { SceneByVariableRepeater } from './components/SceneByVariableRepeater';\nexport { SceneControlsSpacer } from './components/SceneControlsSpacer';\nexport {\n SceneFlexLayout,\n SceneFlexItem,\n type SceneFlexItemState,\n type SceneFlexItemLike,\n} from './components/layout/SceneFlexLayout';\nexport { SceneCSSGridLayout, SceneCSSGridItem } from './components/layout/CSSGrid/SceneCSSGridLayout';\nexport { SceneGridLayout } from './components/layout/grid/SceneGridLayout';\nexport { SceneGridItem } from './components/layout/grid/SceneGridItem';\nexport { SceneGridRow } from './components/layout/grid/SceneGridRow';\nexport { type SceneGridItemStateLike, type SceneGridItemLike } from './components/layout/grid/types';\nexport { SplitLayout } from './components/layout/split/SplitLayout';\nexport {\n type SceneAppPageLike,\n type SceneRouteMatch,\n type SceneAppPageState,\n type SceneAppDrilldownView,\n type SceneAppRoute,\n} from './components/SceneApp/types';\nexport { SceneApp, useSceneApp } from './components/SceneApp/SceneApp';\nexport { SceneAppPage } from './components/SceneApp/SceneAppPage';\nexport { SceneReactObject } from './components/SceneReactObject';\nexport { SceneObjectRef } from './core/SceneObjectRef';\nexport {\n PanelBuilders,\n PanelOptionsBuilders,\n FieldConfigBuilders,\n FieldConfigOverridesBuilder,\n} from './core/PanelBuilders';\nexport { FieldConfigBuilder } from './core/PanelBuilders/FieldConfigBuilder';\nexport { VizPanelBuilder } from './core/PanelBuilders/VizPanelBuilder';\nexport { SceneDebugger } from './components/SceneDebugger/SceneDebugger';\nexport { VariableValueSelectWrapper } from './variables/components/VariableValueSelectors';\nexport { renderSelectForVariable } from './variables/components/VariableValueSelect';\nexport { VizConfigBuilder } from './core/PanelBuilders/VizConfigBuilder';\nexport { VizConfigBuilders } from './core/PanelBuilders/VizConfigBuilders';\nexport { type VizConfig } from './core/PanelBuilders/types';\n\nexport const sceneUtils = {\n getUrlWithAppState,\n registerRuntimePanelPlugin,\n registerRuntimeDataSource,\n registerVariableMacro,\n cloneSceneObjectState,\n syncStateFromSearchParams,\n getUrlState,\n renderPrometheusLabelFilters,\n\n // Variable guards\n isAdHocVariable,\n isConstantVariable,\n isCustomVariable,\n isDataSourceVariable,\n isIntervalVariable,\n isQueryVariable,\n isTextBoxVariable,\n isGroupByVariable,\n};\n\nexport { SafeSerializableSceneObject } from './utils/SafeSerializableSceneObject';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgIO,MAAM,UAAa,GAAA;AAAA,EACxB,kBAAA;AAAA,EACA,0BAAA;AAAA,EACA,yBAAA;AAAA,EACA,qBAAA;AAAA,EACA,qBAAA;AAAA,EACA,yBAAA;AAAA,EACA,WAAA;AAAA,EACA,4BAAA;AAAA,EAGA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,gBAAA;AAAA,EACA,oBAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AACF;;;;"}
@@ -0,0 +1,37 @@
1
+ import { SceneObjectBase } from '../core/SceneObjectBase.js';
2
+
3
+ class DataProviderProxy extends SceneObjectBase {
4
+ constructor(state) {
5
+ super({
6
+ source: state.source,
7
+ data: state.source.resolve().state.data
8
+ });
9
+ this.addActivationHandler(() => {
10
+ this._subs.add(
11
+ this.state.source.resolve().subscribeToState((newState, oldState) => {
12
+ if (newState.data !== oldState.data) {
13
+ this.setState({ data: newState.data });
14
+ }
15
+ })
16
+ );
17
+ });
18
+ }
19
+ setContainerWidth(width) {
20
+ var _a, _b;
21
+ (_b = (_a = this.state.source.resolve()).setContainerWidth) == null ? void 0 : _b.call(_a, width);
22
+ }
23
+ isDataReadyToDisplay() {
24
+ var _a, _b, _c;
25
+ return (_c = (_b = (_a = this.state.source.resolve()).isDataReadyToDisplay) == null ? void 0 : _b.call(_a)) != null ? _c : true;
26
+ }
27
+ cancelQuery() {
28
+ var _a, _b;
29
+ (_b = (_a = this.state.source.resolve()).cancelQuery) == null ? void 0 : _b.call(_a);
30
+ }
31
+ getResultsStream() {
32
+ return this.state.source.resolve().getResultsStream();
33
+ }
34
+ }
35
+
36
+ export { DataProviderProxy };
37
+ //# sourceMappingURL=DataProviderProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataProviderProxy.js","sources":["../../../src/querying/DataProviderProxy.ts"],"sourcesContent":["import { Observable } from 'rxjs';\nimport { SceneObjectBase } from '../core/SceneObjectBase';\nimport { SceneObjectRef } from '../core/SceneObjectRef';\nimport { SceneDataState, SceneDataProvider, SceneDataProviderResult } from '../core/types';\n\nexport interface DataProviderSharerState extends SceneDataState {\n source: SceneObjectRef<SceneDataProvider>;\n}\n\nexport class DataProviderProxy extends SceneObjectBase<DataProviderSharerState> implements SceneDataProvider {\n public constructor(state: DataProviderSharerState) {\n super({\n source: state.source,\n data: state.source.resolve().state.data,\n });\n\n this.addActivationHandler(() => {\n this._subs.add(\n this.state.source.resolve().subscribeToState((newState, oldState) => {\n if (newState.data !== oldState.data) {\n this.setState({ data: newState.data });\n }\n })\n );\n });\n }\n\n public setContainerWidth(width: number) {\n this.state.source.resolve().setContainerWidth?.(width);\n }\n\n public isDataReadyToDisplay() {\n return this.state.source.resolve().isDataReadyToDisplay?.() ?? true;\n }\n\n public cancelQuery() {\n this.state.source.resolve().cancelQuery?.();\n }\n\n public getResultsStream(): Observable<SceneDataProviderResult> {\n return this.state.source.resolve().getResultsStream();\n }\n}\n"],"names":[],"mappings":";;AASO,MAAM,0BAA0B,eAAsE,CAAA;AAAA,EACpG,YAAY,KAAgC,EAAA;AACjD,IAAM,KAAA,CAAA;AAAA,MACJ,QAAQ,KAAM,CAAA,MAAA;AAAA,MACd,IAAM,EAAA,KAAA,CAAM,MAAO,CAAA,OAAA,GAAU,KAAM,CAAA,IAAA;AAAA,KACpC,CAAA,CAAA;AAED,IAAA,IAAA,CAAK,qBAAqB,MAAM;AAC9B,MAAA,IAAA,CAAK,KAAM,CAAA,GAAA;AAAA,QACT,IAAA,CAAK,MAAM,MAAO,CAAA,OAAA,GAAU,gBAAiB,CAAA,CAAC,UAAU,QAAa,KAAA;AACnE,UAAI,IAAA,QAAA,CAAS,IAAS,KAAA,QAAA,CAAS,IAAM,EAAA;AACnC,YAAA,IAAA,CAAK,QAAS,CAAA,EAAE,IAAM,EAAA,QAAA,CAAS,MAAM,CAAA,CAAA;AAAA,WACvC;AAAA,SACD,CAAA;AAAA,OACH,CAAA;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AAAA,EAEO,kBAAkB,KAAe,EAAA;AA3B1C,IAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA4BI,IAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA,CAAK,KAAM,CAAA,MAAA,CAAO,OAAQ,EAAA,EAAE,sBAA5B,IAAgD,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,EAAA,KAAA,CAAA,CAAA;AAAA,GAClD;AAAA,EAEO,oBAAuB,GAAA;AA/BhC,IAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,CAAA;AAgCI,IAAA,OAAA,CAAO,sBAAK,KAAM,CAAA,MAAA,CAAO,OAAQ,EAAA,EAAE,yBAA5B,IAAwD,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,KAAA,IAAA,GAAA,EAAA,GAAA,IAAA,CAAA;AAAA,GACjE;AAAA,EAEO,WAAc,GAAA;AAnCvB,IAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAoCI,IAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA,CAAK,KAAM,CAAA,MAAA,CAAO,OAAQ,EAAA,EAAE,WAA5B,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AAAA,GACF;AAAA,EAEO,gBAAwD,GAAA;AAC7D,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,MAAO,CAAA,OAAA,GAAU,gBAAiB,EAAA,CAAA;AAAA,GACtD;AACF;;;;"}
package/dist/index.d.ts CHANGED
@@ -1422,6 +1422,17 @@ declare class SceneQueryRunner extends SceneObjectBase<QueryRunnerState> impleme
1422
1422
  private isQueryModeAuto;
1423
1423
  }
1424
1424
 
1425
+ interface DataProviderSharerState extends SceneDataState {
1426
+ source: SceneObjectRef<SceneDataProvider>;
1427
+ }
1428
+ declare class DataProviderProxy extends SceneObjectBase<DataProviderSharerState> implements SceneDataProvider {
1429
+ constructor(state: DataProviderSharerState);
1430
+ setContainerWidth(width: number): void;
1431
+ isDataReadyToDisplay(): boolean;
1432
+ cancelQuery(): void;
1433
+ getResultsStream(): Observable<SceneDataProviderResult>;
1434
+ }
1435
+
1425
1436
  type ExtraQueryDataProcessor = (primary: PanelData, secondary: PanelData) => Observable<PanelData>;
1426
1437
  interface ExtraQueryDescriptor {
1427
1438
  req: DataQueryRequest;
@@ -2116,6 +2127,10 @@ interface SceneGridLayoutState extends SceneObjectState {
2116
2127
  /** Enable or disable item resizing */
2117
2128
  isResizable?: boolean;
2118
2129
  isLazy?: boolean;
2130
+ /** Panel search */
2131
+ showPanelSearch?: boolean;
2132
+ searchString?: string;
2133
+ panelsPerRow?: number;
2119
2134
  /**
2120
2135
  * Fit panels to height of the grid. This will scale down the panels vertically to fit available height.
2121
2136
  * The row height is not changed, only the y position and height of the panels.
@@ -2129,6 +2144,7 @@ declare class SceneGridLayout extends SceneObjectBase<SceneGridLayoutState> impl
2129
2144
  private _skipOnLayoutChange;
2130
2145
  private _oldLayout;
2131
2146
  private _loadOldLayout;
2147
+ private savedLayout;
2132
2148
  constructor(state: SceneGridLayoutState);
2133
2149
  /**
2134
2150
  * SceneLayout interface. Used for example by VizPanelRenderer
@@ -2756,4 +2772,4 @@ declare const sceneUtils: {
2756
2772
  isGroupByVariable: typeof isGroupByVariable;
2757
2773
  };
2758
2774
 
2759
- export { AdHocFiltersVariable, CancelActivationHandler, ConstantVariable, ControlsLayout, CustomFormatterVariable, CustomTransformOperator, CustomTransformerDefinition, CustomVariable, CustomVariableValue, DataLayerFilter, DataRequestEnricher, DataSourceVariable, DeepPartial, EmbeddedScene, EmbeddedSceneState, ExtraQueryDataProcessor, ExtraQueryDescriptor, ExtraQueryProvider, FieldConfigBuilder, FieldConfigBuilders, FieldConfigOverridesBuilder, FiltersRequestEnricher, FormatVariable, GroupByVariable, InterpolationFormatParameter, IntervalVariable, LocalValueVariable, MacroVariableConstructor, MultiValueVariable, MultiValueVariableState, NestedScene, NewSceneObjectAddedEvent, PanelBuilders, PanelOptionsBuilders, QueryRunnerState, QueryVariable, RuntimeDataSource, SafeSerializableSceneObject, SceneActivationHandler, SceneApp, SceneAppDrilldownView, SceneAppPage, SceneAppPageLike, SceneAppPageState, SceneAppRoute, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneComponent, SceneComponentProps, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerProvider, SceneDataLayerProviderState, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataProvider, SceneDataProviderResult, SceneDataQuery, SceneDataState, SceneDataTransformer, SceneDataTransformerState, SceneDeactivationHandler, SceneDebugger, SceneFlexItem, SceneFlexItemLike, SceneFlexItemState, SceneFlexLayout, SceneGridItem, SceneGridItemLike, SceneGridItemStateLike, SceneGridLayout, SceneGridRow, SceneLayout, SceneLayoutChildOptions, SceneLayoutState, SceneObject, SceneObjectBase, SceneObjectRef, SceneObjectState, SceneObjectStateChangedEvent, SceneObjectStateChangedPayload, SceneObjectUrlSyncConfig, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, SceneQueryControllerEntry, SceneQueryControllerEntryType, SceneQueryControllerLike, SceneQueryRunner, SceneReactObject, SceneRefreshPicker, SceneRefreshPickerState, SceneRouteMatch, SceneStateChangedHandler, SceneStatelessBehavior, SceneTimePicker, SceneTimeRange, SceneTimeRangeCompare, SceneTimeRangeLike, SceneTimeRangeState, SceneTimeRangeTransformerBase, SceneTimeZoneOverride, SceneToolbarButton, SceneToolbarInput, SceneUrlSyncOptions, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSet, SceneVariableSetState, SceneVariableState, SceneVariableValueChangedEvent, SceneVariables, SplitLayout, TestVariable, TextBoxVariable, UrlSyncContextProvider, UrlSyncManager, UrlSyncManagerLike, UseStateHookOptions, UserActionEvent, ValidateAndUpdateResult, VariableCustomFormatterFn, VariableDependencyConfig, VariableGetOptionsArgs, VariableValue, VariableValueControl, VariableValueOption, VariableValueSelectWrapper, VariableValueSelectors, VariableValueSingle, VizConfig, VizConfigBuilder, VizConfigBuilders, VizPanel, VizPanelBuilder, VizPanelMenu, VizPanelState, index$1 as behaviors, index as dataLayers, formatRegistry, isCustomVariableValue, isDataLayer, isDataRequestEnricher, isFiltersRequestEnricher, isSceneObject, registerQueryWithController, registerRuntimeDataSource, renderSelectForVariable, sceneGraph, sceneUtils, useSceneApp, useSceneObjectState, useUrlSync };
2775
+ export { AdHocFiltersVariable, CancelActivationHandler, ConstantVariable, ControlsLayout, CustomFormatterVariable, CustomTransformOperator, CustomTransformerDefinition, CustomVariable, CustomVariableValue, DataLayerFilter, DataProviderProxy, DataRequestEnricher, DataSourceVariable, DeepPartial, EmbeddedScene, EmbeddedSceneState, ExtraQueryDataProcessor, ExtraQueryDescriptor, ExtraQueryProvider, FieldConfigBuilder, FieldConfigBuilders, FieldConfigOverridesBuilder, FiltersRequestEnricher, FormatVariable, GroupByVariable, InterpolationFormatParameter, IntervalVariable, LocalValueVariable, MacroVariableConstructor, MultiValueVariable, MultiValueVariableState, NestedScene, NewSceneObjectAddedEvent, PanelBuilders, PanelOptionsBuilders, QueryRunnerState, QueryVariable, RuntimeDataSource, SafeSerializableSceneObject, SceneActivationHandler, SceneApp, SceneAppDrilldownView, SceneAppPage, SceneAppPageLike, SceneAppPageState, SceneAppRoute, SceneByFrameRepeater, SceneByVariableRepeater, SceneCSSGridItem, SceneCSSGridLayout, SceneCanvasText, SceneComponent, SceneComponentProps, SceneControlsSpacer, SceneDataLayerBase, SceneDataLayerControls, SceneDataLayerProvider, SceneDataLayerProviderState, SceneDataLayerSet, SceneDataLayerSetBase, SceneDataNode, SceneDataProvider, SceneDataProviderResult, SceneDataQuery, SceneDataState, SceneDataTransformer, SceneDataTransformerState, SceneDeactivationHandler, SceneDebugger, SceneFlexItem, SceneFlexItemLike, SceneFlexItemState, SceneFlexLayout, SceneGridItem, SceneGridItemLike, SceneGridItemStateLike, SceneGridLayout, SceneGridRow, SceneLayout, SceneLayoutChildOptions, SceneLayoutState, SceneObject, SceneObjectBase, SceneObjectRef, SceneObjectState, SceneObjectStateChangedEvent, SceneObjectStateChangedPayload, SceneObjectUrlSyncConfig, SceneObjectUrlSyncHandler, SceneObjectUrlValue, SceneObjectUrlValues, SceneObjectWithUrlSync, SceneQueryControllerEntry, SceneQueryControllerEntryType, SceneQueryControllerLike, SceneQueryRunner, SceneReactObject, SceneRefreshPicker, SceneRefreshPickerState, SceneRouteMatch, SceneStateChangedHandler, SceneStatelessBehavior, SceneTimePicker, SceneTimeRange, SceneTimeRangeCompare, SceneTimeRangeLike, SceneTimeRangeState, SceneTimeRangeTransformerBase, SceneTimeZoneOverride, SceneToolbarButton, SceneToolbarInput, SceneUrlSyncOptions, SceneVariable, SceneVariableDependencyConfigLike, SceneVariableSet, SceneVariableSetState, SceneVariableState, SceneVariableValueChangedEvent, SceneVariables, SplitLayout, TestVariable, TextBoxVariable, UrlSyncContextProvider, UrlSyncManager, UrlSyncManagerLike, UseStateHookOptions, UserActionEvent, ValidateAndUpdateResult, VariableCustomFormatterFn, VariableDependencyConfig, VariableGetOptionsArgs, VariableValue, VariableValueControl, VariableValueOption, VariableValueSelectWrapper, VariableValueSelectors, VariableValueSingle, VizConfig, VizConfigBuilder, VizConfigBuilders, VizPanel, VizPanelBuilder, VizPanelMenu, VizPanelState, index$1 as behaviors, index as dataLayers, formatRegistry, isCustomVariableValue, isDataLayer, isDataRequestEnricher, isFiltersRequestEnricher, isSceneObject, registerQueryWithController, registerRuntimeDataSource, renderSelectForVariable, sceneGraph, sceneUtils, useSceneApp, useSceneObjectState, useUrlSync };