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
(feat) column() resizing now supports 'list' | 'compact' modes
* fixgridstack#2358
when your grid is display a sorted list of items, we now support reflowing that content during column resize and compact() methods.
* compact() now takes options which today can be
CompactOptions = 'list' | 'compact';
* column(N) now has new options
ColumnOptions = 'list' | 'compact' | 'moveScale', etc...
* also optimized some code while stepping in debugger.
API is backward compatible and defaults to the same behavior.
TODO: remember bigger width and restore back when going up in columns...
/** callback to update the DOM attributes since this class is generic (no HTML or other info) for items that changed - see _notify() */
10
10
typeOnChangeCB=(nodes: GridStackNode[])=>void;
@@ -258,20 +258,23 @@ export class GridStackEngine {
258
258
return!this.collide(nn);
259
259
}
260
260
261
-
/** re-layout grid items to reclaim any empty space */
262
-
publiccompact(): GridStackEngine{
261
+
/** re-layout grid items to reclaim any empty space - optionally keeping the sort order exactly the same (list mode) vs truly finding an empty spaces */
/** different layout options when changing # of columns,
53
-
* including a custom function that takes new/old column count, and array of new/old positions
52
+
/**
53
+
* different layout options when changing # of columns, including a custom function that takes new/old column count, and array of new/old positions
54
54
* Note: new list may be partially already filled if we have a cache of the layout at that size and new items were added later.
55
+
* Options are:
56
+
* 'list' - treat items as sorted list, keeping items (unsized unless too big for column count) sequentially reflowing them
57
+
* 'compact' - similar to list, but using compact() method which will possibly re-order items if an empty slots are available due to a larger item needing to be pushed to next row
58
+
* 'moveScale' - will scale and move items by the ratio new newColumnCount / oldColumnCount
59
+
* 'move' | 'scale' - will only size or move items
60
+
* 'none' will leave items unchanged, unless they don't fit in column count
0 commit comments