8000 Merge pull request #3034 from adumesny/gh-pages · gridstack/gridstack.js@dc17f08 · GitHub
[go: up one dir, main page]

Skip to content

Commit dc17f08

Browse files
authored
Merge pull request #3034 from adumesny/gh-pages
web 12.1.0
2 parents 251bef1 + a614d75 commit dc17f08

15 files changed

+29
-409
lines changed

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,3 @@ node_modules/gridstack/dist/*
1616
!node_modules/gridstack/dist/gridstack-all.js.map
1717
!node_modules/gridstack/dist/gridstack.css
1818
!node_modules/gridstack/dist/gridstack.min.css
19-
!node_modules/gridstack/dist/es5/
20-
node_modules/gridstack/dist/es5/*
21-
!node_modules/gridstack/dist/es5/gridstack-poly.js
22-
!node_modules/gridstack/dist/es5/gridstack-all.js
23-
!node_modules/gridstack/dist/es5/gridstack-all.js.map

demo/events.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
function addEvents(grid, id) {
2-
let g = (id !== undefined ? 'grid' + id + ' ' : '');
2+
let g = (id !== undefined ? 'grid' + id : '');
33

44
grid.on('added removed change', function(event, items) {
55
let str = '';
66
items.forEach(function(item) { str += ' (' + item.x + ',' + item.y + ' ' + item.w + 'x' + item.h + ')'; });
7-
console.log(g + event.type + ' ' + items.length + ' items (x,y w h):' + str );
7+
console.log((g || items[0].grid.opts.id) + ' ' + event.type + ' ' + items.length + ' items (x,y w h):' + str );
88
})
99
.on('enable', function(event) {
10-
let grid = event.target;
11-
console.log(g + 'enable');
10+
let el = event.target;
11+
console.log((g || el.gridstackNode.grid.opts.id) + ' enable');
1212
})
1313
.on('disable', function(event) {
14-
let grid = event.target;
15-
console.log(g + 'disable');
14+
let el = event.target;
15+
console.log((g || el.gridstackNode.grid.opts.id) + ' disable');
1616
})
1717
.on('dragstart', function(event, el) {
1818
let n = el.gridstackNode;
1919
let x = el.getAttribute('gs-x'); // verify node (easiest) and attr are the same
2020
let y = el.getAttribute('gs-y');
21-
console.log(g + 'dragstart ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');
21+
console.log((g || el.gridstackNode.grid.opts.id) + ' dragstart ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');
2222
})
2323
.on('drag', function(event, el) {
2424
let n = el.gridstackNode;
2525
let x = el.getAttribute('gs-x'); // verify node (easiest) and attr are the same
2626
let y = el.getAttribute('gs-y');
27-
// console.log(g + 'drag ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');
27+
// console.log((g || el.gridstackNode.grid.opts.id) + ' drag ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');
2828
})
2929
.on('dragstop', function(event, el) {
3030
let n = el.gridstackNode;
3131
let x = el.getAttribute('gs-x'); // verify node (easiest) and attr are the same
3232
let y = el.getAttribute('gs-y');
33-
console.log(g + 'dragstop ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');
33+
console.log((g || el.gridstackNode.grid.opts.id) + ' dragstop ' + (n.content || '') + ' pos: (' + n.x + ',' + n.y + ') = (' + x + ',' + y + ')');
3434
})
3535
.on('dropped', function(event, previousNode, newNode) {
3636
if (previousNode) {
37-
console.log(g + 'dropped - Removed widget from grid:', previousNode);
37+
console.log((g || previousNode.grid.opts.id) + ' dropped - Removed widget from grid:', previousNode);
3838
}
3939
if (newNode) {
40-
console.log(g + 'dropped - Added widget in grid:', newNode);
40+
console.log((g || newNode.grid.opts.id) + ' dropped - Added widget in grid:', newNode);
4141
}
4242
})
4343
.on('resizestart', function(event, el) {
4444
let n = el.gridstackNode;
4545
let rec = el.getBoundingClientRect();
46-
console.log(`${g} resizestart ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);
46+
console.log(`${g || el.gridstackNode.grid.opts.id} resizestart ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);
4747

4848
})
4949
.on('resize', function(event, el) {
5050
let n = el.gridstackNode;
5151
let rec = el.getBoundingClientRect();
52-
console.log(`${g} resize ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);
52+
console.log(`${g || el.gridstackNode.grid.opts.id} resize ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);
5353
})
5454
.on('resizestop', function(event, el) {
5555
let n = el.gridstackNode;
5656
let rec = el.getBoundingClientRect();
57-
console.log(`${g} resizestop ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);
57+
console.log(`${g || el.gridstackNode.grid.opts.id} resizestop ${n.content || ''} size: (${n.w}x${n.h}) = (${Math.round(rec.width)}x${Math.round(rec.height)})px`);
5858
});
5959
}

demo/nested.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h1>Nested grids demo</h1>
4040
<a class="btn btn-primary" onClick="load(false)" href="#">Load</a>
4141
<br><br>
4242
<!-- grid will be added here -->
43-
</div>d
43+
</div>
4444
<script src="events.js"></script>
4545
<script type="text/javascript">
4646
// NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736
@@ -74,12 +74,8 @@ <h1>Nested grids demo</h1>
7474
// create and load it all from JSON above
7575
let grid = GridStack.addGrid(document.querySelector('.container-fluid'), options);
7676

77-
// add debug event handlers to each grid (no global set on parent yet)
78-
let gridEls = GridStack.getElements('.grid-stack');
79-
gridEls.forEach(gridEl => {
80-
let grid = gridEl.gridstack;
81-
addEvents(grid, grid.opts.id);
82-
})
77+
// add debug event handlers to main grid (new v12.1 handles sub-grids too)
78+
addEvents(grid);
8379

8480
// setup drag drop behavior
8581
let sidebarContent = [

demo/web1.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212

1313
<script type="module" src="https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.esm.js"></script>
1414
<script nomodule="" src="https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.js"></script>
15-
16-
<!-- support for IE -->
17-
<script src="../node_modules/gridstack/dist/es5/gridstack-poly.js"></script>
18-
<script src="../node_modules/gridstack/dist/es5/gridstack-all.js"></script>
15+
<script src="../node_modules/gridstack/dist/gridstack-all.js"></script>
1916
</head>
2017

2118
<body>

demo/web2.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212

1313
<script type="module" src="https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.esm.js"></script>
1414
<script nomodule="" src="https://unpkg.com/ionicons@4.5.10-0/dist/ionicons/ionicons.js"></script>
15-
16-
<!-- support for IE -->
17-
<script src="../node_modules/gridstack/dist/es5/gridstack-poly.js"></script>
18-
<script src="../node_modules/gridstack/dist/es5/gridstack-all.js"></script>
15+
<script src="../node_modules/gridstack/dist/gridstack-all.js"></script>
1916

2017
<style type="text/css">
2118
.grid-stack-item-removing {

demo/website.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
<meta name="keywords"
99
content="gridstack, typescript, jquery, grid, layout, drag-n-drop, widgets, js, javascript, gridstack.js, dashboard" />
1010
F42D <title>gridstack.js | Build interactive dashboards in minutes.</title>
11-
12-
<!-- ES5 support for IE -->
13-
<script src="../node_modules/gridstack/dist/es5/gridstack-poly.js"></script>
14-
<script src="../node_modules/gridstack/dist/es5/gridstack-all.js"></script>
11+
<script src="../node_modules/gridstack/dist/gridstack-all.js"></script>
1512

1613
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
1714
<script src="https://getbootstrap.com/docs/4.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-xrRywqdh3PHs8keKZN+8zzc5TX0GRTLCcmivcbNJWm2rs5C8PRhcEn3czEjhAO9o" crossorigin="anonymous"></script>

index.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@
5959
<!-- Favicon -->
6060
<link rel="icon" type="image/x-icon" href="favicon.ico" />
6161

62-
<!-- ES5 support for IE -->
63-
<script src="node_modules/gridstack/dist/es5/gridstack-poly.js"></script>
64-
<script src="node_modules/gridstack/dist/es5/gridstack-all.js"></script>
62+
<script src="node_modules/gridstack/dist/gridstack-all.js"></script>
6563

6664
<!-- Highlight.js -->
6765
<!-- Used to add style to <code> tags -->

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

Lines changed: 0 additions & 3 deletions
This file was deleted.

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

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)
0