@grafana/scenes 0.28.0 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v0.28.1 (Thu Aug 31 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - SceneGridLayout: Remove z-index [#308](https://github.com/grafana/scenes/pull/308) ([@torkelo](https://github.com/torkelo))
6
+
7
+ #### Authors: 1
8
+
9
+ - Torkel Ödegaard ([@torkelo](https://github.com/torkelo))
10
+
11
+ ---
12
+
1
13
  # v0.28.0 (Thu Aug 31 2023)
2
14
 
3
15
  #### 🚀 Enhancement
@@ -34,17 +34,14 @@ function SceneGridLayoutRenderer({ model }) {
34
34
  isBounded: false
35
35
  }, layout.map((gridItem, index) => {
36
36
  const sceneChild = model.getSceneLayoutChild(gridItem.i);
37
- const style = { zIndex: layout.length - index };
38
37
  return isLazy ? /* @__PURE__ */ React.createElement(LazyLoader, {
39
38
  key: sceneChild.state.key,
40
- style,
41
39
  "data-panelid": sceneChild.state.key
42
40
  }, /* @__PURE__ */ React.createElement(sceneChild.Component, {
43
41
  model: sceneChild,
44
42
  key: sceneChild.state.key
45
43
  })) : /* @__PURE__ */ React.createElement("div", {
46
44
  key: sceneChild.state.key,
47
- style,
48
45
  "data-panelid": sceneChild.state.key
49
46
  }, /* @__PURE__ */ React.createElement(sceneChild.Component, {
50
47
  model: sceneChild,
@@ -1 +1 @@
1
- {"version":3,"file":"SceneGridLayoutRenderer.js","sources":["../../../../../src/components/layout/grid/SceneGridLayoutRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport ReactGridLayout from 'react-grid-layout';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { SceneComponentProps } from '../../../core/types';\nimport { GRID_CELL_VMARGIN, GRID_COLUMN_COUNT, GRID_CELL_HEIGHT } from './constants';\nimport { LazyLoader } from './LazyLoader';\nimport { SceneGridLayout } from './SceneGridLayout';\nimport { SceneGridItemLike } from './types';\n\nexport function SceneGridLayoutRenderer({ model }: SceneComponentProps<SceneGridLayout>) {\n const { children, isLazy, isDraggable, isResizable } = model.useState();\n validateChildrenSize(children);\n\n return (\n <AutoSizer disableHeight>\n {({ width }) => {\n if (width === 0) {\n return null;\n }\n\n const layout = model.buildGridLayout(width);\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 style={{ width: `${width}px`, height: '100%' }}>\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={false}\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 // @ts-ignore: ignoring for now until we make the size type numbers-only\n layout={layout}\n onDragStop={model.onDragStop}\n onResizeStop={model.onResizeStop}\n onLayoutChange={model.onLayoutChange}\n isBounded={false}\n >\n {layout.map((gridItem, index) => {\n const sceneChild = model.getSceneLayoutChild(gridItem.i)!;\n // This it have panels higher up the page have higher z-index\n const style = { zIndex: layout.length - index };\n\n return isLazy ? (\n <LazyLoader key={sceneChild.state.key!} style={style} data-panelid={sceneChild.state.key}>\n <sceneChild.Component model={sceneChild} key={sceneChild.state.key} />\n </LazyLoader>\n ) : (\n <div key={sceneChild.state.key} style={style} data-panelid={sceneChild.state.key}>\n <sceneChild.Component model={sceneChild} key={sceneChild.state.key} />\n </div>\n );\n })}\n </ReactGridLayout>\n </div>\n );\n }}\n </AutoSizer>\n );\n}\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"],"names":[],"mappings":";;;;;;AASgB,SAAA,uBAAA,CAAwB,EAAE,KAAA,EAA+C,EAAA;AACvF,EAAA,MAAM,EAAE,QAAU,EAAA,MAAA,EAAQ,aAAa,WAAY,EAAA,GAAI,MAAM,QAAS,EAAA,CAAA;AACtE,EAAA,oBAAA,CAAqB,QAAQ,CAAA,CAAA;AAE7B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA;AAAA,IAAU,aAAa,EAAA,IAAA;AAAA,GACrB,EAAA,CAAC,EAAE,KAAA,EAAY,KAAA;AACd,IAAA,IAAI,UAAU,CAAG,EAAA;AACf,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAEA,IAAM,MAAA,MAAA,GAAS,KAAM,CAAA,eAAA,CAAgB,KAAK,CAAA,CAAA;AAE1C,IAAA,uBAMG,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,MAAI,OAAO,EAAE,KAAA,EAAO,CAAG,EAAA,KAAA,CAAA,EAAA,CAAA,EAAW,QAAQ,MAAO,EAAA;AAAA,KAAA,kBAC/C,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA;AAAA,MACC,KAAA;AAAA,MAMA,WAAA,EAAa,eAAe,KAAQ,GAAA,GAAA;AAAA,MACpC,aAAa,WAAe,IAAA,IAAA,GAAA,WAAA,GAAA,KAAA;AAAA,MAC5B,gBAAA,EAAkB,CAAC,CAAA,EAAG,CAAC,CAAA;AAAA,MACvB,gBAAkB,EAAA,KAAA;AAAA,MAClB,MAAA,EAAQ,CAAC,iBAAA,EAAmB,iBAAiB,CAAA;AAAA,MAC7C,IAAM,EAAA,iBAAA;AAAA,MACN,SAAW,EAAA,gBAAA;AAAA,MACX,eAAA,EAAiB,CAAqB,kBAAA,EAAA,KAAA,CAAM,KAAM,CA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AC3D,EAAA,IACE,QAAS,CAAA,IAAA;AAAA,IACP,CAAC,CACC,KAAA,CAAA,CAAE,KAAM,CAAA,MAAA,KAAW,UACnB,CAAE,CAAA,KAAA,CAAM,KAAU,KAAA,KAAA,CAAA,IAClB,EAAE,KAAM,CAAA,CAAA,KAAM,KACd,CAAA,IAAA,CAAA,CAAE,MAAM,CAAM,KAAA,KAAA,CAAA;AAAA,GAElB,EAAA;AACA,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA,CAAA;AAAA,GAC3D;AACF;;;;"}
1
+ {"version":3,"file":"SceneGridLayoutRenderer.js","sources":["../../../../../src/components/layout/grid/SceneGridLayoutRenderer.tsx"],"sourcesContent":["import React from 'react';\nimport ReactGridLayout from 'react-grid-layout';\nimport AutoSizer from 'react-virtualized-auto-sizer';\nimport { SceneComponentProps } from '../../../core/types';\nimport { GRID_CELL_VMARGIN, GRID_COLUMN_COUNT, GRID_CELL_HEIGHT } from './constants';\nimport { LazyLoader } from './LazyLoader';\nimport { SceneGridLayout } from './SceneGridLayout';\nimport { SceneGridItemLike } from './types';\n\nexport function SceneGridLayoutRenderer({ model }: SceneComponentProps<SceneGridLayout>) {\n const { children, isLazy, isDraggable, isResizable } = model.useState();\n validateChildrenSize(children);\n\n return (\n <AutoSizer disableHeight>\n {({ width }) => {\n if (width === 0) {\n return null;\n }\n\n const layout = model.buildGridLayout(width);\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 style={{ width: `${width}px`, height: '100%' }}>\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={false}\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 // @ts-ignore: ignoring for now until we make the size type numbers-only\n layout={layout}\n onDragStop={model.onDragStop}\n onResizeStop={model.onResizeStop}\n onLayoutChange={model.onLayoutChange}\n isBounded={false}\n >\n {layout.map((gridItem, index) => {\n const sceneChild = model.getSceneLayoutChild(gridItem.i)!;\n\n return isLazy ? (\n <LazyLoader key={sceneChild.state.key!} data-panelid={sceneChild.state.key}>\n <sceneChild.Component model={sceneChild} key={sceneChild.state.key} />\n </LazyLoader>\n ) : (\n <div key={sceneChild.state.key} data-panelid={sceneChild.state.key}>\n <sceneChild.Component model={sceneChild} key={sceneChild.state.key} />\n </div>\n );\n })}\n </ReactGridLayout>\n </div>\n );\n }}\n </AutoSizer>\n );\n}\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"],"names":[],"mappings":";;;;;;AASgB,SAAA,uBAAA,CAAwB,EAAE,KAAA,EAA+C,EAAA;AACvF,EAAA,MAAM,EAAE,QAAU,EAAA,MAAA,EAAQ,aAAa,WAAY,EAAA,GAAI,MAAM,QAAS,EAAA,CAAA;AACtE,EAAA,oBAAA,CAAqB,QAAQ,CAAA,CAAA;AAE7B,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA;AAAA,IAAU,aAAa,EAAA,IAAA;AAAA,GACrB,EAAA,CAAC,EAAE,KAAA,EAAY,KAAA;AACd,IAAA,IAAI,UAAU,CAAG,EAAA;AACf,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAEA,IAAM,MAAA,MAAA,GAAS,KAAM,CAAA,eAAA,CAAgB,KAAK,CAAA,CAAA;AAE1C,IAAA,uBAMG,KAA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,EAAK,WAAW,KAAM,CAAA,GAAA;AAAA,OAAK,CACtE,oBAEC,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,QAAI,GAAA,EAAK,WAAW,KAAM,CAAA,GAAA;AAAA,QAAK,cAAA,EAAc,WAAW,KAAM,CAAA,GAAA;AAAA,OAC7D,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAW,SAAX,EAAA;AAAA,QAAqB,KAAO,EAAA,UAAA;AAAA,QAAY,GAAA,EAAK,WAAW,KAAM,CAAA,GAAA;AAAA,OAAK,CACtE,CAAA,CAAA;AAAA,KAEH,CACH,CACF,CAAA,CAAA;AAAA,GAGN,CAAA,CAAA;AAEJ,CAAA;AAEA,SAAS,qBAAqB,QAA+B,EAAA;AAC3D,EAAA,IACE,QAAS,CAAA,IAAA;AAAA,IACP,CAAC,CACC,KAAA,CAAA,CAAE,KAAM,CAAA,MAAA,KAAW,UACnB,CAAE,CAAA,KAAA,CAAM,KAAU,KAAA,KAAA,CAAA,IAClB,EAAE,KAAM,CAAA,CAAA,KAAM,KACd,CAAA,IAAA,CAAA,CAAE,MAAM,CAAM,KAAA,KAAA,CAAA;AAAA,GAElB,EAAA;AACA,IAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA,CAAA;AAAA,GAC3D;AACF;;;;"}
package/dist/index.js CHANGED
@@ -5354,17 +5354,14 @@ function SceneGridLayoutRenderer({ model }) {
5354
5354
  isBounded: false
5355
5355
  }, layout.map((gridItem, index) => {
5356
5356
  const sceneChild = model.getSceneLayoutChild(gridItem.i);
5357
- const style = { zIndex: layout.length - index };
5358
5357
  return isLazy ? /* @__PURE__ */ React__default["default"].createElement(LazyLoader, {
5359
5358
  key: sceneChild.state.key,
5360
- style,
5361
5359
  "data-panelid": sceneChild.state.key
5362
5360
  }, /* @__PURE__ */ React__default["default"].createElement(sceneChild.Component, {
5363
5361
  model: sceneChild,
5364
5362
  key: sceneChild.state.key
5365
5363
  })) : /* @__PURE__ */ React__default["default"].createElement("div", {
5366
5364
  key: sceneChild.state.key,
5367
- style,
5368
5365
  "data-panelid": sceneChild.state.key
5369
5366
  }, /* @__PURE__ */ React__default["default"].createElement(sceneChild.Component, {
5370
5367
  model: sceneChild,