Skip to content

Commit

Permalink
Merge pull request gridstack#2882 from adumesny/gh-pages
Browse files Browse the repository at this point in the history
web v11.1.1
  • Loading branch information
adumesny authored Nov 26, 2024
2 parents bbeeb43 + 83a0ce0 commit caafb56
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 21 deletions.
11 changes: 7 additions & 4 deletions demo/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,18 @@ h1 {
.grid-stack {
background: #FAFAD2;
}
.grid-stack.grid-stack-static {
background: #eee;
}

.sidebar > .grid-stack-item,
.grid-stack-item-content {
text-align: center;
background-color: #18bc9c;
}
.ui-draggable-disabled.ui-resizable-disabled > .grid-stack-item-content {
background-color: #777;
}

.grid-stack-item-removing {
opacity: 0.5;
Expand All @@ -66,8 +72,5 @@ h1 {
}
.grid-stack.grid-stack-nested {
background: none;
/* background-color: red; */
/* take entire space */
position: absolute;
inset: 0; /* TODO change top: if you have content in nested grid */
inset: 0;
}
29 changes: 23 additions & 6 deletions demo/nested.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ <h1>Nested grids demo</h1>
<div class="sidebar-item grid-stack-item">Drag nested</div>
</div>
<br />
<div>
<span>Grid Mode: </span>
<input type="radio" id="static" name="mode" value="true" onClick="setStatic(true)"><label for="static">static</label>
  <input type="radio" id="edit" name="mode" value="false" checked onClick="setStatic(false)"><label for="edit">editable</label>
</div>
<span>entire save/re-create:</span>
<a class="btn btn-primary" onClick="save()" href="#">Save</a>
<a class="btn btn-primary" onClick="destroy()" href="#">Destroy</a>
Expand All @@ -36,20 +41,27 @@ <h1>Nested grids demo</h1>
<a class="btn btn-primary" onClick="load(false)" href="#">Load</a>
<br><br>
<!-- grid will be added here -->
</div>
</div>d
<script src="events.js"></script>
<script type="text/javascript">
// NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736
GridStack.renderCB = function(el, w) {
if (w.content) el.innerHTML = w.content;
};

let staticGrid = false;
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}];
let sub2 = [ {x:0, y:0, h:2}, {x:1, y:1, w:2}];
let count = 0;
[...sub1, ...sub2].forEach(d => d.content = String(count++));
let subOptions = {
cellHeight: 50, // should be 50 - top/bottom
column: 'auto', // size to match container. make sure to include gridstack-extra.min.css
acceptWidgets: true, // will accept .grid-stack-item by default
margin: 5,
// by default we inherit from parent, but you can override any sub-grid options here
// column: 'auto', // DEFAULT size to match container. make sure to include gridstack-extra.min.css
};
let options = { // main grid options
staticGrid, // test - force children to inherit too if we set to true above ^^^
// disableDrag: true,
// disableResize: true,
cellHeight: 50,
margin: 5,
minRow: 2, // don't collapse when empty
Expand All @@ -59,7 +71,7 @@ <h1>Nested grids demo</h1>
subGridOpts: subOptions, // all sub grids will default to those
children: [
{x:0, y:0, content: 'regular item'},
{x:1, y:0, w:4, h:4, sizeToContent: true, subGridOpts: {children: sub1, id:'sub1_grid', class: 'sub1'}},
{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'}},
{x:5, y:0, w:3, h:4, subGridOpts: {children: sub2, id:'sub2_grid', class: 'sub2'}},
]
};
Expand All @@ -80,6 +92,11 @@ <h1>Nested grids demo</h1>
];
GridStack.setupDragIn('.sidebar-item', undefined, sidebarContent);

function setStatic(val) {
staticGrid = val;
grid.setStatic(staticGrid);
}

function addWidget() {
grid.addWidget({x:0, y:100, content:"new item"});
}
Expand Down
2 changes: 1 addition & 1 deletion node_modules/gridstack/dist/es5/gridstack-all.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node_modules/gridstack/dist/es5/gridstack-all.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node_modules/gridstack/dist/es5/gridstack-poly.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node_modules/gridstack/dist/gridstack-all.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node_modules/gridstack/dist/gridstack-all.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion node_modules/gridstack/dist/gridstack.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"homepage": "http://gridstackjs.com",
"dependencies": {
"gridstack": "11.1.0"
"gridstack": "11.1.1"
},
"devDependencies": {
"prettier": "3.2.5"
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# yarn lockfile v1


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

prettier@3.2.5:
version "3.2.5"
Expand Down

0 comments on commit caafb56

Please sign in to comment.