Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22ec93a

Browse files
committed
added gs-size-to-content support
* fix #2886 * untested but should be fine :)
1 parent 078b08a commit 22ec93a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

doc/CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Change log
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
66
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
77

8+
- [11.1.1-dev (TBD)](#1111-dev-tbd)
89
- [11.1.1 (2024-11-26)](#1111-2024-11-26)
910
- [11.1.0 (2024-11-17)](#1110-2024-11-17)
1011
- [11.0.1 (2024-10-21)](#1101-2024-10-21)
@@ -117,6 +118,10 @@ Change log
117118

118119
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
119120

121+
## 11.1.1-dev (TBD)
122+
* fix: [#2877](https://github.com/gridstack/gridstack.js/pull/2877) angular wrapper uses standalone, while now being compatible down to ng14. thanks to [andre-steudel](https://github.com/andre-steudel)
123+
* fix: [#2886](https://github.com/gridstack/gridstack.js/issues/2886) added `gs-size-to-content` support
124+
120125
## 11.1.1 (2024-11-26)
121126
* fix: [#2878](https://github.com/gridstack/gridstack.js/pull/2878) make sure sub-grid inherit parent opts by default, with subgrid defaults.
122127
* fix: [#2879](https://github.com/gridstack/gridstack.js/pull/2879) sub-grid item `sizeToContent:true` now handle content above/below sub grid.

src/gridstack.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ export class GridStack {
333333
minRow: rowAttr ? rowAttr : Utils.toNumber(el.getAttribute('gs-min-row')) || gridDefaults.minRow,
334334
maxRow: rowAttr ? rowAttr : Utils.toNumber(el.getAttribute('gs-max-row')) || gridDefaults.maxRow,
335335
staticGrid: Utils.toBool(el.getAttribute('gs-static')) || gridDefaults.staticGrid,
336+
sizeToContent: Utils.toBool(el.getAttribute('gs-size-to-content')) || undefined,
336337
draggable: {
337338
handle: (opts.handleClass ? '.' + opts.handleClass : (opts.handle ? opts.handle : '')) || gridDefaults.draggable.handle,
338339
},
@@ -1719,6 +1720,7 @@ export class GridStack {
17191720
noMove: 'gs-no-move',
17201721
locked: 'gs-locked',
17211722
id: 'gs-id',
1723+
sizeToContent: 'gs-size-to-content',
17221724
};
17231725
for (const key in attrs) {
17241726
if (node[key]) { // 0 is valid for x,y only but done above already and not in list anyway
@@ -1741,6 +1743,7 @@ export class GridStack {
17411743
n.noResize = Utils.toBool(el.getAttribute('gs-no-resize'));
17421744
n.noMove = Utils.toBool(el.getAttribute('gs-no-move'));
17431745
n.locked = Utils.toBool(el.getAttribute('gs-locked'));
1746+
n.sizeToContent = Utils.toBool(el.getAttribute('gs-size-to-content'));
17441747
n.id = el.getAttribute('gs-id');
17451748

17461749
// read but never written out

src/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ export interface GridStackOptions {
256256
rtl?: boolean | 'auto';
257257

258258
/** set to true if all grid items (by default, but item can also override) height should be based on content size instead of WidgetItem.h to avoid v-scrollbars.
259-
Note: this is still row based, not pixels, so it will use ceil(getBoundingClientRect().height / getCellHeight()) */
260-
sizeToContent?: boolean;
259+
* Note: this is still row based, not pixels, so it will use ceil(getBoundingClientRect().height / getCellHeight())
260+
*/
261+
sizeToContent?: boolean;
261262

262263
/**
263264
* makes grid static (default?: false). If `true` widgets are not movable/resizable.

0 commit comments

Comments
 (0)