Merge pull request #42 from Coffey-Labs/gridstack-13
Take gridstack to 13, and handle the grid it may not return
This commit is contained in:
Generated
+4
-4
@@ -15,7 +15,7 @@
|
|||||||
"@codemirror/state": "^6.7.4",
|
"@codemirror/state": "^6.7.4",
|
||||||
"@codemirror/view": "^6.43.11",
|
"@codemirror/view": "^6.43.11",
|
||||||
"echarts": "^6.1.0",
|
"echarts": "^6.1.0",
|
||||||
"gridstack": "^11.5.0"
|
"gridstack": "^13.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-static": "^3.0.10",
|
"@sveltejs/adapter-static": "^3.0.10",
|
||||||
@@ -751,9 +751,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/gridstack": {
|
"node_modules/gridstack": {
|
||||||
"version": "11.5.1",
|
"version": "13.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/gridstack/-/gridstack-11.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/gridstack/-/gridstack-13.2.0.tgz",
|
||||||
"integrity": "sha512-qgbH65F6TtyKyi9t6fCkrxLhiobgYR3RBjnK0AzZl+YO7hreMVlsZ1MFbkPV0+7ZhjXdvcaRSZp3UA1yAJqYBQ==",
|
"integrity": "sha512-+ImmOx6qd1wiF0EagY7e/pPdngh/6s0FM+r9hh4d8AsXslO51iHEuoAF7CMrXCFr0Xqd0X4WS/bqRLXtEUThug==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "paypal",
|
"type": "paypal",
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@
|
|||||||
"@codemirror/state": "^6.7.4",
|
"@codemirror/state": "^6.7.4",
|
||||||
"@codemirror/view": "^6.43.11",
|
"@codemirror/view": "^6.43.11",
|
||||||
"echarts": "^6.1.0",
|
"echarts": "^6.1.0",
|
||||||
"gridstack": "^11.5.0"
|
"gridstack": "^13.2.0"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"cookie": "^0.7.2"
|
"cookie": "^0.7.2"
|
||||||
|
|||||||
@@ -167,7 +167,12 @@
|
|||||||
function setupGrid() {
|
function setupGrid() {
|
||||||
if (!gridEl || !dashboard?.panels) return;
|
if (!gridEl || !dashboard?.panels) return;
|
||||||
grid?.destroy(false);
|
grid?.destroy(false);
|
||||||
grid = GridStack.init({ float: true, cellHeight: 60, column: 12 }, gridEl);
|
// gridstack 13 returns null when it cannot bind to the element, where
|
||||||
|
// 11 always handed back a grid. `gridEl` is guarded above so this
|
||||||
|
// should not happen -- but the type says it can, and a missed drag is
|
||||||
|
// better than a thrown error inside an effect.
|
||||||
|
grid = GridStack.init({ float: true, cellHeight: 60, column: 12 }, gridEl) ?? undefined;
|
||||||
|
if (!grid) return;
|
||||||
grid.on('change', (_event: Event, items: GridStackNode[]) => {
|
grid.on('change', (_event: Event, items: GridStackNode[]) => {
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
const panel = dashboard?.panels?.find((p) => p.id === item.id);
|
const panel = dashboard?.panels?.find((p) => p.id === item.id);
|
||||||
|
|||||||
Reference in New Issue
Block a user