Skip to content

Commit 85eb176

Browse files
authored
Merge pull request #2542 from adumesny/master
new `GridStackOptions.responsive`
2 parents 94ed4d9 + 00a54e0 commit 85eb176

27 files changed

+377
-275
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Join us on Slack: [https://gridstackjs.slack.com](https://gridstackjs.slack.com)
4646
- [Migrating to v7](#migrating-to-v7)
4747
- [Migrating to v8](#migrating-to-v8)
4848
- [Migrating to v9](#migrating-to-v9)
49+
- [Migrating to v10](#migrating-to-v10)
4950
- [jQuery Application](#jquery-application)
5051
- [Changes](#changes)
5152
- [The Team](#the-team)
@@ -450,6 +451,15 @@ New addition - see release notes about `sizeToContent` feature.
450451
Possible break:
451452
* `GridStack.onParentResize()` is now called `onResize()` as grid now directly track size change, no longer involving parent per say to tell us anything. Note sure why it was public.
452453
454+
## Migrating to v10
455+
456+
we now support much richer responsive behavior with `GridStackOptions.responsive` including any breakpoint width:column pairs, or automatic column sizing.
457+
458+
breaking change:
459+
* `disableOneColumnMode`, `oneColumnSize` have been removed (thought we temporary convert if you have them). use `{ responsive: breakpoints: [{w:768, c:1}] }` for the same behavior.
460+
* 1 column mode switch is no longer by default (`responsive` is not defined) as too many new users had issues. Instead set it explicitly (see above).
461+
* `oneColumnModeDomSort` has been removed. Planning to support per column layouts at some future times. TBD
462+
453463
# jQuery Application
454464
455465
This is **old and no longer apply to v6+**. You'll need to use v5.1.1 and before

angular/projects/demo/src/app/app.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ export class AppComponent implements OnInit {
6262
cellHeight: 50,
6363
margin: 5,
6464
minRow: 2, // don't collapse when empty
65-
disableOneColumnMode: true,
6665
acceptWidgets: true,
6766
children: this.subChildren
6867
};
@@ -71,7 +70,6 @@ export class AppComponent implements OnInit {
7170
cellHeight: 50,
7271
margin: 5,
7372
minRow: 1, // don't collapse when empty
74-
disableOneColumnMode: true,
7573
removable: '.trash',
7674
acceptWidgets: true,
7775
float: true,

demo/canvasJS.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ <h1>CanvasJS grid demo</h1>
2323
let grid = GridStack.init({
2424
cellHeight: 'initial', // start square but will set to % of window width later
2525
animate: false, // show immediate (animate: true is nice for user dragging though)
26-
disableOneColumnMode: true, // will manually do 1 column
2726
float: true
2827
});
2928

demo/column.html

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ <h1>column() grid demo (fix cellHeight)</h1>
3333
<a onClick="random()" class="btn btn-primary" href="#">random</a>
3434
<a onClick="addWidget()" class="btn btn-primary" href="#">Add Widget</a>
3535
column:
36-
<a onClick="setOneColumn(false)" class="btn btn-primary" href="#">1</a>
37-
<a onClick="setOneColumn(true)" class="btn btn-primary" href="#">1 DOM</a>
36+
<a onClick="column(1)" class="btn btn-primary" href="#">1</a>
3837
<a onClick="column(2)" class="btn btn-primary" href="#">2</a>
3938
<a onClick="column(3)" class="btn btn-primary" href="#">3</a>
4039
<a onClick="column(4)" class="btn btn-primary" href="#">4</a>
@@ -107,14 +106,6 @@ <h1>column() grid demo (fix cellHeight)</h1>
107106
grid.column(n, layout);
108107
text.innerHTML = n;
109108
}
110-
function setOneColumn(dom) {
111-
if (grid.opts.column === 1 && grid.opts.oneColumnModeDomSort !== dom) {
112-
column(12); // go ack to 12 before going to new column1 version
113-
}
114-
grid.opts.oneColumnModeDomSort = dom;
115-
grid.column(1, layout);
116-
text.innerHTML = dom ? '1 DOM' : '1';
117-
}
118109
// dummy test method that moves items to the right each new layout... grid engine will validate those values (can't be neg or out of bounds) anyway...
119110
function columnLayout(column, oldColumn, nodes, oldNodes) {
120111
oldNodes.forEach(n => {
@@ -126,7 +117,6 @@ <h1>column() grid demo (fix cellHeight)</h1>
126117
function setLayout(name) {
127118
layout = name === 'custom' ? this.columnLayout : name;
128119
}
129-
// setOneColumn(true); // test dom order
130120
</script>
131121
</body>
132122
</html>

demo/custom-engine.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ <h1>Custom Engine</h1>
5050

5151
let grid = GridStack.init({
5252
float: true,
53-
disableOneColumnMode: true,
5453
cellHeight: 70
5554
}).load(items);
5655
addEvents(grid);

demo/drag-and-drop-dataTransfer.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ <h1>Event DataTransfer Demo</h1>
3434
<script type="text/javascript">
3535
let options = {
3636
column: 12,
37-
disableOneColumnMode: true,
3837
acceptWidgets: function (el) { return true; }
3938
};
4039
let items = [

demo/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ <h1>Demos</h1>
2222
<li><a href="react-hooks-controlled-multiple.html">ReactJS (Hooks), multiple grid, controlled (NOT Ideal)</a></li>
2323
<li><a href="react-hooks.html">ReactJS (Hooks)</a></li>
2424
<li><a href="react.html">ReactJS</a></li>
25-
<li><a href="responsive.html">Responsive</a></li>
25+
<li><a href="responsive.html">Responsive: by column size</a></li>
26+
<li><a href="responsive_break.html">Responsive: using breakpoints</a></li>
2627
<li><a href="right-to-left(rtl).html">Right-To-Left (RTL)</a></li>
2728
<li><a href="serialization.html">Serialization</a></li>
2829
<li><a href="sizeToContent.html">Size To Content</a></li>

demo/mobile.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ <h1>Simple mobile demo</h1>
1818
<script type="text/javascript">
1919
let grid = GridStack.init({
2020
column: 3,
21-
disableOneColumnMode: true,
2221
});
2322
grid.load([{x:0, y:0, content: '1'}, {x:1, y:0, h:2, content: '2'}, {x:2, y:0, content: '3'}])
2423
</script>

demo/nested.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ <h1>Nested grids demo</h1>
4747
cellHeight: 50,
4848
margin: 5,
4949
minRow: 2, // don't collapse when empty
50-
disableOneColumnMode: true,
5150
acceptWidgets: true,
5251
id: 'main',
5352
children: [

demo/old_two-jq.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ <h1>Two grids demo (old v5.1.1 Jquery version)</h1>
5656
column: 6,
5757
minRow: 1, // don't collapse when empty
5858
cellHeight: 70,
59-
disableOneColumnMode: true,
6059
float: false,
6160
// dragIn: '.sidebar .grid-stack-item', // add draggable to class
6261
// dragInOptions: { revert: 'invalid', scroll: false, appendTo: 'body', helper: 'clone' }, // clone

0 commit comments

Comments
 (0)