@grafana/scenes 6.49.0 → 6.49.1--canary.1313.20102090431.0

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.
@@ -1,13 +1,12 @@
1
1
  import React, { useRef, useEffect } from 'react';
2
2
  import ReactGridLayout from 'react-grid-layout';
3
3
  import { GRID_CELL_HEIGHT, GRID_COLUMN_COUNT, GRID_CELL_VMARGIN } from './constants.js';
4
- import { LazyLoader } from '../LazyLoader.js';
5
4
  import { useStyles2 } from '@grafana/ui';
6
5
  import { css, cx } from '@emotion/css';
7
6
  import { useMeasure } from 'react-use';
8
7
 
9
8
  function SceneGridLayoutRenderer({ model }) {
10
- const { children, isLazy, isDraggable, isResizable } = model.useState();
9
+ const { children, isDraggable, isResizable } = model.useState();
11
10
  const [outerDivRef, { width, height }] = useMeasure();
12
11
  const ref = useRef(null);
13
12
  useEffect(() => {
@@ -53,7 +52,6 @@ function SceneGridLayoutRenderer({ model }) {
53
52
  grid: model,
54
53
  layoutItem: gridItem,
55
54
  index,
56
- isLazy,
57
55
  totalCount: layout.length
58
56
  }
59
57
  ))
@@ -70,25 +68,10 @@ const gridWrapperClass = css({
70
68
  });
71
69
  const GridItemWrapper = React.forwardRef((props, ref) => {
72
70
  var _a;
73
- const { grid, layoutItem, index, totalCount, isLazy, style, onLoad, onChange, children, ...divProps } = props;
71
+ const { grid, layoutItem, index, totalCount, style, onLoad, onChange, children, ...divProps } = props;
74
72
  const sceneChild = grid.getSceneLayoutChild(layoutItem.i);
75
73
  const className = (_a = sceneChild.getClassName) == null ? void 0 : _a.call(sceneChild);
76
74
  const innerContent = /* @__PURE__ */ React.createElement(sceneChild.Component, { model: sceneChild, key: sceneChild.state.key });
77
- if (isLazy) {
78
- return /* @__PURE__ */ React.createElement(
79
- LazyLoader,
80
- {
81
- ...divProps,
82
- key: sceneChild.state.key,
83
- "data-griditem-key": sceneChild.state.key,
84
- className: cx(className, props.className),
85
- style,
86
- ref
87
- },
88
- innerContent,
89
- children
90
- );
91
- }
92
75
  return /* @__PURE__ */ React.createElement(
93
76
  "div",
94
77
  {
@@ -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 ref={outerDivRef as RefCallback<HTMLDivElement>} className={gridWrapperClass}>\n {renderGrid(width, height)}\n </div>\n );\n}\n\nconst gridWrapperClass = css({\n flex: '1 1 auto',\n position: 'relative',\n zIndex: 1,\n width: '100%',\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":";;;;;;;;AAYgB,SAAA,uBAAA,CAAwB,EAAE,KAAA,EAA+C,EAAA;AACvF,EAAA,MAAM,EAAE,QAAU,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,wBAAA;AAAA,MACF,MAAO,EAAA,cAAA;AAAA,MACP,WAAY,EAAA,GAAA;AAAA,MACZ,aAAc,EAAA,OAAA;AAAA,MACd,cAAe,EAAA;AAAA;AAAA,GAEnB,CACF,CAAA;AAEJ,CAAC,CAAA;AAED,YAAA,CAAa,WAAc,GAAA,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;AAAA,KAC3B;AAAA,IACA,GAAK,EAAA;AAAA,MACH,OAAS,EAAA;AAAA,KACX;AAAA,IACA,yBAA2B,EAAA;AAAA,MACzB,OAAS,EAAA;AAAA;AACX,GACD,CAAA;AACH;;;;"}
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 { 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, 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 totalCount={layout.length}\n />\n ))}\n </ReactGridLayout>\n </div>\n );\n };\n\n return (\n <div ref={outerDivRef as RefCallback<HTMLDivElement>} className={gridWrapperClass}>\n {renderGrid(width, height)}\n </div>\n );\n}\n\nconst gridWrapperClass = css({\n flex: '1 1 auto',\n position: 'relative',\n zIndex: 1,\n width: '100%',\n});\n\ninterface GridItemWrapperProps extends React.HTMLAttributes<HTMLDivElement> {\n grid: SceneGridLayout;\n layoutItem: ReactGridLayout.Layout;\n index: number;\n totalCount: number;\n}\n\nconst GridItemWrapper = React.forwardRef<HTMLDivElement, GridItemWrapperProps>((props, ref) => {\n const { grid, layoutItem, index, totalCount, 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 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":";;;;;;;AAWgB,SAAA,uBAAA,CAAwB,EAAE,KAAA,EAA+C,EAAA;AACvF,EAAA,MAAM,EAAE,QAAU,EAAA,WAAA,EAAa,WAAY,EAAA,GAAI,MAAM,QAAS,EAAA;AAC9D,EAAA,MAAM,CAAC,WAAa,EAAA,EAAE,OAAO,MAAO,EAAC,IAAI,UAAW,EAAA;AACpD,EAAM,MAAA,GAAA,GAAM,OAA8B,IAAI,CAAA;AAK9C,EAAA,SAAA,CAAU,MAAM;AACd,IAAqB,oBAAA,CAAA,GAAA,EAAK,CAAC,CAAC,WAAW,CAAA;AAAA,GACzC,EAAG,CAAC,WAAW,CAAC,CAAA;AAEhB,EAAA,oBAAA,CAAqB,QAAQ,CAAA;AAE7B,EAAM,MAAA,UAAA,GAAa,CAACA,MAAAA,EAAeC,OAAmB,KAAA;AACpD,IAAI,IAAA,CAACD,MAAS,IAAA,CAACC,OAAQ,EAAA;AACrB,MAAO,OAAA,IAAA;AAAA;AAGT,IAAA,MAAM,MAAS,GAAA,KAAA,CAAM,eAAgBD,CAAAA,MAAAA,EAAOC,OAAM,CAAA;AAElD,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAI,GAAU,EAAA,KAAA,EAAO,EAAE,KAAA,EAAO,CAAGD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A,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,CAAE,EAAA,wBAAA;AAAA,MACF,MAAO,EAAA,cAAA;AAAA,MACP,WAAY,EAAA,GAAA;AAAA,MACZ,aAAc,EAAA,OAAA;AAAA,MACd,cAAe,EAAA;AAAA;AAAA,GAEnB,CACF,CAAA;AAEJ,CAAC,CAAA;AAED,YAAA,CAAa,WAAc,GAAA,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;AAAA,KAC3B;AAAA,IACA,GAAK,EAAA;AAAA,MACH,OAAS,EAAA;AAAA,KACX;AAAA,IACA,yBAA2B,EAAA;AAAA,MACzB,OAAS,EAAA;AAAA;AACX,GACD,CAAA;AACH;;;;"}
package/dist/index.js CHANGED
@@ -12837,7 +12837,7 @@ function isSceneGridLayout(child) {
12837
12837
  }
12838
12838
 
12839
12839
  function SceneGridLayoutRenderer({ model }) {
12840
- const { children, isLazy, isDraggable, isResizable } = model.useState();
12840
+ const { children, isDraggable, isResizable } = model.useState();
12841
12841
  const [outerDivRef, { width, height }] = reactUse.useMeasure();
12842
12842
  const ref = React.useRef(null);
12843
12843
  React.useEffect(() => {
@@ -12883,7 +12883,6 @@ function SceneGridLayoutRenderer({ model }) {
12883
12883
  grid: model,
12884
12884
  layoutItem: gridItem,
12885
12885
  index,
12886
- isLazy,
12887
12886
  totalCount: layout.length
12888
12887
  }
12889
12888
  ))
@@ -12900,25 +12899,10 @@ const gridWrapperClass = css.css({
12900
12899
  });
12901
12900
  const GridItemWrapper = React__default.default.forwardRef((props, ref) => {
12902
12901
  var _a;
12903
- const { grid, layoutItem, index, totalCount, isLazy, style, onLoad, onChange, children, ...divProps } = props;
12902
+ const { grid, layoutItem, index, totalCount, style, onLoad, onChange, children, ...divProps } = props;
12904
12903
  const sceneChild = grid.getSceneLayoutChild(layoutItem.i);
12905
12904
  const className = (_a = sceneChild.getClassName) == null ? void 0 : _a.call(sceneChild);
12906
12905
  const innerContent = /* @__PURE__ */ React__default.default.createElement(sceneChild.Component, { model: sceneChild, key: sceneChild.state.key });
12907
- if (isLazy) {
12908
- return /* @__PURE__ */ React__default.default.createElement(
12909
- LazyLoader,
12910
- {
12911
- ...divProps,
12912
- key: sceneChild.state.key,
12913
- "data-griditem-key": sceneChild.state.key,
12914
- className: css.cx(className, props.className),
12915
- style,
12916
- ref
12917
- },
12918
- innerContent,
12919
- children
12920
- );
12921
- }
12922
12906
  return /* @__PURE__ */ React__default.default.createElement(
12923
12907
  "div",
12924
12908
  {