Skip to content

Commit f13c22c

Browse files
authored
Merge pull request #3013 from adumesny/master
feat: column now uses var(--gs-column-width)
2 parents 7043258 + 9a2776e commit f13c22c

37 files changed

+214
-268
lines changed

Gruntfile.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ module.exports = function(grunt) {
2121
dist: {
2222
files: {
2323
'dist/gridstack.css': 'src/gridstack.scss',
24-
'dist/gridstack-extra.css': 'src/gridstack-extra.scss'
2524
}
2625
}
2726
},
@@ -33,7 +32,6 @@ module.exports = function(grunt) {
3332
},
3433
files: {
3534
'dist/gridstack.min.css': ['dist/gridstack.css'],
36-
'dist/gridstack-extra.min.css': ['dist/gridstack-extra.css']
3735
}
3836
}
3937
},
@@ -42,7 +40,6 @@ module.exports = function(grunt) {
4240
files: {
4341
'dist/es5/gridstack-poly.js': ['src/gridstack-poly.js'],
4442
'dist/src/gridstack.scss': ['src/gridstack.scss'],
45-
'dist/src/gridstack-extra.scss': ['src/gridstack-extra.scss'],
4643
'dist/angular/README.md': ['angular/README.md'],
4744
'dist/angular/src/gridstack.component.ts': ['angular/projects/lib/src/lib/gridstack.component.ts'],
4845
'dist/angular/src/gridstack-item.component.ts': ['angular/projects/lib/src/lib/gridstack-item.component.ts'],

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Join us on Slack: [https://gridstackjs.slack.com](https://join.slack.com/t/grids
3232
- [Extend Library](#extend-library)
3333
- [Extend Engine](#extend-engine)
3434
- [Change grid columns](#change-grid-columns)
35-
- [Custom columns CSS](#custom-columns-css)
35+
- [Custom columns CSS (OLD, not needed with v12+)](#custom-columns-css-old-not-needed-with-v12)
3636
- [Override resizable/draggable options](#override-resizabledraggable-options)
3737
- [Touch devices support](#touch-devices-support)
3838
- [Migrating](#migrating)
@@ -48,6 +48,7 @@ Join us on Slack: [https://gridstackjs.slack.com](https://join.slack.com/t/grids
4848
- [Migrating to v9](#migrating-to-v9)
4949
- [Migrating to v10](#migrating-to-v10)
5050
- [Migrating to v11](#migrating-to-v11)
51+
- [Migrating to v12](#migrating-to-v12)
5152
- [jQuery Application](#jquery-application)
5253
- [Changes](#changes)
5354
- [Usage Trend](#usage-trend)
@@ -207,6 +208,8 @@ GridStack makes it very easy if you need [1-12] columns out of the box (default
207208
GridStack.init( {column: N} );
208209
```
209210

211+
NOTE: step 2 is OLD and not needed with v12+ which uses CSS variables instead of classes
212+
210213
2) also include `gridstack-extra.css` if **N < 12** (else custom CSS - see next). Without these, things will not render/work correctly.
211214
```html
212215
<link href="node_modules/gridstack/dist/gridstack.min.css" rel="stylesheet"/>
@@ -219,7 +222,9 @@ Note: class `.grid-stack-N` will automatically be added and we include `gridstac
219222

220223
See example: [2 grids demo](http://gridstack.github.io/gridstack.js/demo/two.html) with 6 columns
221224

222-
## Custom columns CSS
225+
## Custom columns CSS (OLD, not needed with v12+)
226+
227+
NOTE: step is OLD and not needed with v12+ which uses CSS variables instead of classes
223228

224229
If you need > 12 columns or want to generate the CSS manually you will need to generate CSS rules for `.grid-stack-item[gs-w="X"]` and `.grid-stack-item[gs-x="X"]`.
225230

@@ -491,6 +496,14 @@ GridStack.renderCB = function(el: HTMLElement, w: GridStackNode) {
491496
4. if no `GridStackWidget` is defined, the helper will now be inserted as is, and NOT original sidepanel item.
492497
5. support DOM gs- attr as well as gridstacknode JSON (see two.html) alternatives.
493498
499+
## Migrating to v12
500+
501+
* column and cell height code has been re-writen to use browser CSS variables, and we no longer need a tons of custom CSS classes!
502+
this fixes a long standing issue where people forget to include the right CSS for non 12 columns layouts, and a big speedup in many cases (many columns, or small cellHeight values).
503+
504+
**Breaking change:**
505+
* `gridstack-extra.min.css` no longer exist, nor is custom column CSS needed. API/options hasn't changed.
506+
494507
# jQuery Application
495508
496509
This is **old and no longer apply to v6+**. You'll need to use v5.1.1 and before

angular/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ MyComponent CSS
1818

1919
```css
2020
@import "gridstack/dist/gridstack.min.css";
21-
@import "gridstack/dist/gridstack-extra.min.css"; // if you use 2-11 column
2221

2322
.grid-stack {
2423
background: #fafad2;

angular/angular.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
],
5656
"styles": [
5757
"node_modules/gridstack/dist/gridstack.min.css",
58-
"node_modules/gridstack/dist/gridstack-extra.min.css",
5958
"projects/demo/src/styles.css"
6059
],
6160
"scripts": []
@@ -121,7 +120,6 @@
121120
],
122121
"styles": [
123122
"node_modules/gridstack/dist/gridstack.min.css",
124-
"node_modules/gridstack/dist/gridstack-extra.min.css",
125123
"projects/demo/src/styles.css"
126124
],
127125
"scripts": []

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class AppComponent implements OnInit {
5656
// nested grid options
5757
private subOptions: GridStackOptions = {
5858
cellHeight: 50, // should be 50 - top/bottom
59-
column: 'auto', // size to match container. make sure to include gridstack-extra.min.css
59+
column: 'auto', // size to match container
6060
acceptWidgets: true, // will accept .grid-stack-item by default
6161
margin: 5,
6262
};

demo/column.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<title>Column grid demo</title>
88

99
<link rel="stylesheet" href="demo.css"/>
10-
<link rel="stylesheet" href="../dist/gridstack-extra.css"/>
1110
<script src="../dist/gridstack-all.js"></script>
1211
</head>
1312
<body>

demo/mobile.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<title>Simple mobile demo</title>
88

99
<link rel="stylesheet" href="demo.css"/>
10-
<link rel="stylesheet" href="../dist/gridstack-extra.css"/>
1110
<script src="../dist/gridstack-all.js"></script>
1211

1312
</head>

demo/nested.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>Nested grids demo</title>
88
<link rel="stylesheet" href="demo.css"/>
9-
<link rel="stylesheet" href="../dist/gridstack-extra.min.css"/>
109
<script src="../dist/gridstack-all.js"></script>
1110
</head>
1211
<body>

demo/nested_advanced.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>Advance Nested grids demo</title>
88
<link rel="stylesheet" href="demo.css"/>
9-
<link rel="stylesheet" href="../dist/gridstack-extra.min.css"/> <!-- required for [2-11] column of sub-grids -->
109
<!-- test using CSS rather than minRow -->
1110
<style type="text/css">
1211
.container-fluid > .grid-stack { min-height: 250px}
@@ -19,7 +18,6 @@ <h1>Advanced Nested grids demo</h1>
1918
<p>Create sub-grids (darker background) on the fly, by dragging items completely over others (nest) vs partially (push) using
2019
the new v7 API <code>GridStackOptions.subGridDynamic=true</code></p>
2120
<p>This will use the new delay drag&drop option <code>DDDragOpt.pause</code> to tell the gesture difference</p>
22-
<p>Note: <code>gridstack-extra.min.css</code> is required for [2-11] column of sub-grids</p>
2321
<a class="btn btn-primary" onClick="addMainWidget()" href="#">Add Widget</a>
2422
<a class="btn btn-primary" onClick="addNewWidget(0)" href="#">Add W Grid0</a>
2523
<a class="btn btn-primary" onClick="addNewWidget(1)" href="#">Add W Grid1</a>
@@ -41,7 +39,7 @@ <h1>Advanced Nested grids demo</h1>
4139
<script type="text/javascript">
4240
let subOptions = {
4341
cellHeight: 50, // should be 50 - top/bottom
44-
column: 'auto', // size to match container. make sure to include gridstack-extra.min.css
42+
column: 'auto', // size to match container
4543
acceptWidgets: true, // will accept .grid-stack-item by default
4644
margin: 5,
4745
subGridDynamic: true, // make it recursive for all future sub-grids

demo/nested_constraint.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1">
77
<title>Constraint nested grids demo</title>
88
<link rel="stylesheet" href="demo.css"/>
9-
<link rel="stylesheet" href="../dist/gridstack-extra.min.css"/>
109
<script src="../dist/gridstack-all.js"></script>
1110
<style type="text/css">
1211
.grid-stack-item.sub .grid-stack-item-content {
@@ -41,7 +40,7 @@ <h1>Constraint Nested grids demo</h1>
4140
[...sub1, ...sub2].forEach(d => d.content = String(count++));
4241
let subOptions = {
4342
cellHeight: 50,
44-
column: 'auto', // size to match container. make sure to include gridstack-extra.min.css
43+
column: 'auto', // size to match container
4544
itemClass: 'sub', // style sub items differently and use to prevent dragging in/out
4645
acceptWidgets: '.grid-stack-item.sub', // only pink sub items can be inserted
4746
margin: 2,

0 commit comments

Comments
 (0)