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

Skip to content

Commit caafb56

Browse files
authored
Merge pull request #2882 from adumesny/gh-pages
web v11.1.1
2 parents bbeeb43 + 83a0ce0 commit caafb56

File tree

10 files changed

+41
-21
lines changed

10 files changed

+41
-21
lines changed

demo/demo.css

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,18 @@ h1 {
4444
.grid-stack {
4545
background: #FAFAD2;
4646
}
47+
.grid-stack.grid-stack-static {
48+
background: #eee;
49+
}
4750

4851
.sidebar > .grid-stack-item,
4952
.grid-stack-item-content {
5053
text-align: center;
5154
background-color: #18bc9c;
5255
}
56+
.ui-draggable-disabled.ui-resizable-disabled > .grid-stack-item-content {
57+
background-color: #777;
58+
}
5359

5460
.grid-stack-item-removing {
5561
opacity: 0.5;
@@ -66,8 +72,5 @@ h1 {
6672
}
6773
.grid-stack.grid-stack-nested {
6874
background: none;
69-
/* background-color: red; */
70-
/* take entire space */
71-
position: absolute;
72-
inset: 0; /* TODO change top: if you have content in nested grid */
75+
inset: 0;
7376
}

demo/nested.html

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ <h1>Nested grids demo</h1>
2525
<div class="sidebar-item grid-stack-item">Drag nested</div>
2626
</div>
2727
<br />
28+
<div>
29+
<span>Grid Mode: </span>
30+
<input type="radio" id="static" name="mode" value="true" onClick="setStatic(true)"><label for="static">static</label>
31+
  <input type="radio" id="edit" name="mode" value="false" checked onClick="setStatic(false)"><label for="edit">editable</label>
32+
</div>
2833
<span>entire save/re-create:</span>
2934
<a class="btn btn-primary" onClick="save()" href="#">Save</a>
3035
<a class="btn btn-primary" onClick="destroy()" href="#">Destroy</a>
@@ -36,20 +41,27 @@ <h1>Nested grids demo</h1>
3641
<a class="btn btn-primary" onClick="load(false)" href="#">Load</a>
3742
<br><br>
3843
<!-- grid will be added here -->
39-
</div>
44+
</div>d
4045
<script src="events.js"></script>
4146
<script type="text/javascript">
47+
// NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736
48+
GridStack.renderCB = function(el, w) {
49+
if (w.content) el.innerHTML = w.content;
50+
};
51+
52+
let staticGrid = false;
4253
let sub1 = [ {x:0, y:0}, {x:1, y:0}, {x:2, y:0}, {x:3, y:0}, {x:0, y:1}, {x:1, y:1}];
4354
let sub2 = [ {x:0, y:0, h:2}, {x:1, y:1, w:2}];
4455
let count = 0;
4556
[...sub1, ...sub2].forEach(d => d.content = String(count++));
4657
let subOptions = {
47-
cellHeight: 50, // should be 50 - top/bottom
48-
column: 'auto', // size to match container. make sure to include gridstack-extra.min.css
49-
acceptWidgets: true, // will accept .grid-stack-item by default
50-
margin: 5,
58+
// by default we inherit from parent, but you can override any sub-grid options here
59+
// column: 'auto', // DEFAULT size to match container. make sure to include gridstack-extra.min.css
5160
};
5261
let options = { // main grid options
62+
staticGrid, // test - force children to inherit too if we set to true above ^^^
63+
// disableDrag: true,
64+
// disableResize: true,
5365
cellHeight: 50,
5466
margin: 5,
5567
minRow: 2, // don't collapse when empty
@@ -59,7 +71,7 @@ <h1>Nested grids demo</h1>
5971
subGridOpts: subOptions, // all sub grids will default to those
6072
children: [
6173
{x:0, y:0, content: 'regular item'},
62-
{x:1, y:0, w:4, h:4, sizeToContent: true, subGridOpts: {children: sub1, id:'sub1_grid', class: 'sub1'}},
74+
{x:1, y:0, w:4, h:4, sizeToContent: true, content: '<div>nested grid sizeToContent:true with some header content</div>', subGridOpts: {children: sub1, id:'sub1_grid', class: 'sub1'}},
6375
{x:5, y:0, w:3, h:4, subGridOpts: {children: sub2, id:'sub2_grid', class: 'sub2'}},
6476
]
6577
};
@@ -80,6 +92,11 @@ <h1>Nested grids demo</h1>
8092
];
8193
GridStack.setupDragIn('.sidebar-item', undefined, sidebarContent);
8294

95+
function setStatic(val) {
96+
staticGrid = val;
97+
grid.setStatic(staticGrid);
98+
}
99+
83100
function addWidget() {
84101
grid.addWidget({x:0, y:100, content:"new item"});
85102
}

node_modules/gridstack/dist/es5/gridstack-all.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/gridstack/dist/es5/gridstack-all.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/gridstack/dist/es5/gridstack-poly.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/gridstack/dist/gridstack-all.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/gridstack/dist/gridstack-all.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/gridstack/dist/gridstack.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"homepage": "http://gridstackjs.com",
1818
"dependencies": {
19-
"gridstack": "11.1.0"
19+
"gridstack": "11.1.1"
2020
},
2121
"devDependencies": {
2222
"prettier": "3.2.5"

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# yarn lockfile v1
33

44

5-
6-
version "11.1.0"
7-
resolved "https://registry.yarnpkg.com/gridstack/-/gridstack-11.1.0.tgz#37dc2d15ae950cdcc72a45e82c38299f68f846e7"
8-
integrity sha512-+znlk7IzXRfdWejaZk3AYZMPKtgyAeu7AKrBFZqfCaJxwro5l6Ql2CtazWv3ejDXs1J1ku2x0OXNWDG3QnlLQA==
5+
6+
version "11.1.1"
7+
resolved "https://usw1.packages.broadcom.com/artifactory/api/npm/tis-npm-virtual/gridstack/-/gridstack-11.1.1.tgz#50f6c7a46f703a5c92a9819a607b22a6e8bd9703"
8+
integrity sha512-St50Ra3FlxxERrMcnRAmxQKE8paXOIwQ88zpafUkzdOYg9Sn/3/Vf4EqCWv8P/hkNIlfW/8VYsk8fk+3DQPVxQ==
99

1010
1111
version "3.2.5"

0 commit comments

Comments
 (0)