From b6d9cc34a889437ea12cd1f9d3fb03063f1ca18c Mon Sep 17 00:00:00 2001 From: Houssam Salem Date: Wed, 18 Aug 2021 15:46:21 +1000 Subject: [PATCH 1/2] Don't override node width when switching column mode Fix case where specifying a minimum width for a node will cause the node's width to always be overridden and incorrectly cached, breaking the layout on restore. --- src/gridstack-engine.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gridstack-engine.ts b/src/gridstack-engine.ts index 4356c34b6..3b3cdb88b 100644 --- a/src/gridstack-engine.ts +++ b/src/gridstack-engine.ts @@ -345,7 +345,7 @@ export class GridStackEngine { if (node.maxW) { node.w = Math.min(node.w, node.maxW); } if (node.maxH) { node.h = Math.min(node.h, node.maxH); } - if (node.minW) { node.w = Math.max(node.w, node.minW); } + if (node.minW && node.minW < this.column) { node.w = Math.max(node.w, node.minW); } if (node.minH) { node.h = Math.max(node.h, node.minH); } if (node.w > this.column) { From 1427227015d4487f09e10a951f80efacad030b08 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Sun, 12 Sep 2021 16:39:33 -0700 Subject: [PATCH 2/2] 1835 tweak: Layout incorrectly restored when node has a minimum width --- doc/CHANGES.md | 7 +++++++ src/gridstack-engine.ts | 2 +- src/gridstack.ts | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 4df073e75..7f18079a4 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -5,6 +5,7 @@ Change log **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* +- [4.2.7 (2021-9-12)](#427-2021-9-12) - [4.2.6 (2021-7-11)](#426-2021-7-11) - [4.2.5 (2021-5-31)](#425-2021-5-31) - [4.2.4 (2021-5-29)](#424-2021-5-29) @@ -59,6 +60,12 @@ Change log - [v0.1.0 (2014-11-18)](#v010-2014-11-18) + +## 4.2.7 (2021-9-12) + +* fix [#1817](https://github.com/gridstack/gridstack.js/issues/1817) Enable passing of DragEvent to gridstack dropped event. Thanks [@onepartsam](https://github.com/onepartsam) +* fix [#1835](https://github.com/gridstack/gridstack.js/issues/1835) Layout incorrectly restored when node has a minimum width. Thanks [@hssm](https://github.com/hssm) + ## 4.2.6 (2021-7-11) * fix [#1784](https://github.com/gridstack/gridstack.js/issues/1784) `removable:true` working by itself (without needing `acceptWidgets:true`) diff --git a/src/gridstack-engine.ts b/src/gridstack-engine.ts index 3b3cdb88b..ea7310887 100644 --- a/src/gridstack-engine.ts +++ b/src/gridstack-engine.ts @@ -345,7 +345,7 @@ export class GridStackEngine { if (node.maxW) { node.w = Math.min(node.w, node.maxW); } if (node.maxH) { node.h = Math.min(node.h, node.maxH); } - if (node.minW && node.minW < this.column) { node.w = Math.max(node.w, node.minW); } + if (node.minW && node.minW <= this.column) { node.w = Math.max(node.w, node.minW); } if (node.minH) { node.h = Math.max(node.h, node.minH); } if (node.w > this.column) { diff --git a/src/gridstack.ts b/src/gridstack.ts index d19d3d8ca..868b5f24e 100644 --- a/src/gridstack.ts +++ b/src/gridstack.ts @@ -970,7 +970,7 @@ export class GridStack { // support legacy call for now ? if (arguments.length > 2) { - console.warn('gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update({x, w, content, ...})`. It will be removed soon'); + console.warn('gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update(el, {x, w, content, ...})`. It will be removed soon'); // eslint-disable-next-line prefer-rest-params let a = arguments, i = 1; opt = { x:a[i++], y:a[i++], w:a[i++], h:a[i++] };