You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
1284
-
if(!child){console.log(`Error: resizeToContent() '${GridStack.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return;}
1285
-
constpadding=el.clientHeight-item.clientHeight;// full - available height to our child (minus border, padding...)
1286
-
constitemH=n.h ? n.h*cell-padding : item.clientHeight;// calculated to what cellHeight is or will become (rather than actual to prevent waiting for animation to finish)
el.classList.remove('size-to-content');// get v-scroll back
1297
-
}elseel.classList.add('size-to-content');
1298
-
}
1299
-
if(n.minH&&h<n.minH)h=n.minH;
1300
-
elseif(n.maxH&&h>n.maxH)h=n.maxH;
1301
-
if(h!==n.h){
1302
-
this._ignoreLayoutsNodeChange=true;
1303
-
this.moveNode(n,{h});
1304
-
deletethis._ignoreLayoutsNodeChange;
1305
-
}
1306
-
});
1265
+
/**
1266
+
* Updates widget height to match the content height to avoid v-scrollbar or dead space.
1267
+
* Note: this assumes only 1 child under resizeToContentParent='.grid-stack-item-content' (sized to gridItem minus padding) that is at the entire content size wanted.
1268
+
* useAttrSize set to true if GridStackNode.h should be used instead of actual container height when we don't need to wait for animation to finish to get actual DOM heights
// NOTE: clientHeight & getBoundingClientRect() is undefined for text and other leaf nodes. use <div> container!
1287
+
if(!child){console.log(`Error: resizeToContent() '${GridStack.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return;}
1288
+
constpadding=el.clientHeight-item.clientHeight;// full - available height to our child (minus border, padding...)
1289
+
constitemH=useAttrSize&&n.h ? n.h*cell-padding : item.clientHeight;// calculated to what cellHeight is or will become (rather than actual to prevent waiting for animation to finish)
// update any gridItem height with sizeToContent, but wait for DOM $animation_speed to settle if we changed column count
1659
1659
// TODO: is there a way to know what the final (post animation) size of the content will be so we can animate the column width and height together rather than sequentially ?
0 commit comments