Skip to content

Commit d26fa96

Browse files
authored
Merge pull request #1334 from adumesny/typescript
2.0.0-rc2 release
2 parents 50558cf + e6386fc commit d26fa96

12 files changed

+26
-20
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ alternatively in html
9494
or using CDN (minimized):
9595

9696
```html
97-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]rc/dist/gridstack.min.css" />
98-
<script src="https://cdn.jsdelivr.net/npm/[email protected]rc/dist/gridstack.all.js"></script>
97+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]rc2/dist/gridstack.min.css" />
98+
<script src="https://cdn.jsdelivr.net/npm/[email protected]rc2/dist/gridstack.all.js"></script>
9999
```
100100

101101
.map files are included for debugging purposes.

doc/CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Change log
4444
- add `margin` to replace `verticalMargin` which affects both dimensions in code, rather than one in code the other in CSS.
4545
You can now have perfect square cells (default) [723](https://github.com/gridstack/gridstack.js/issues/723)
4646
- fix [1299](https://github.com/gridstack/gridstack.js/pull/1299) many columns round-off error
47-
- fix [1102](https://github.com/gridstack/gridstack.js/issues/1102) lose functionality when they are moved to a new grid
47+
- fix [1102](https://github.com/gridstack/gridstack.js/issues/1102) loose functionality when they are moved to a new grid
4848

4949
## 1.2.0 (2020-08-01)
5050

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gridstack",
3-
"version": "2.0.0-rc",
3+
"version": "2.0.0-rc2",
44
"description": "TypeScript/Javascript lib for dashboard layout and creation, no external dependencies, with many wrappers (React, Angular, Ember, knockout...)",
55
"main": "./dist/index.js",
66
"typings": "./dist/index.d.ts",

src/gridstack-dd.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// gridstack-dd.ts 2.0.0-rc @preserve
1+
// gridstack-dd.ts 2.0.0-rc2 @preserve
22

33
/**
44
* https://gridstackjs.com/

src/gridstack-engine.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// gridstack-engine.ts 2.0.0-rc @preserve
1+
// gridstack-engine.ts 2.0.0-rc2 @preserve
22

33
/**
44
* https://gridstackjs.com/
@@ -319,13 +319,15 @@ export class GridStackEngine {
319319
return node;
320320
}
321321

322-
public removeNode(node: GridStackNode, removeDOM = true, triggerRemoveEvent = false): GridStackEngine {
323-
if (triggerRemoveEvent) { // we wait until final drop to manually track removed items (rather than during drag)
322+
public removeNode(node: GridStackNode, removeDOM = true, triggerEvent = false): GridStackEngine {
323+
if (triggerEvent) { // we wait until final drop to manually track removed items (rather than during drag)
324324
this.removedNodes.push(node);
325325
}
326326
node._id = null; // hint that node is being removed
327-
this.nodes = this.nodes.filter(n => n !== node);
328-
this._packNodes();
327+
this.nodes.splice(this.nodes.findIndex(n => n === node), 1);
328+
if (!this.float) {
329+
this._packNodes();
330+
}
329331
this._notify(node, removeDOM);
330332
return this;
331333
}

src/gridstack-extra.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* gridstack 2.0.0-rc extra CSS for [2-11] columns (non default)
2+
* gridstack 2.0.0-rc2 extra CSS for [2-11] columns (non default)
33
* https://gridstackjs.com/
44
* (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov
55
* gridstack.js may be freely distributed under the MIT license.

src/gridstack-poly.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// gridstack-poly.js 2.0.0-rc @preserve
1+
// gridstack-poly.js 2.0.0-rc2 @preserve
22

33
/** IE and older browsers Polyfills for this library
44
* https://gridstackjs.com/

src/gridstack.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* required gridstack 2.0.0-rc CSS for default 12 and 1 columnMode size. Use gridstack-extra.css for others
2+
* required gridstack 2.0.0-rc2 CSS for default 12 and 1 columnMode size. Use gridstack-extra.css for others
33
* https://gridstackjs.com/
44
* (c) 2014-2020 Alain Dumesny, Dylan Weiss, Pavel Reznikov
55
* gridstack.js may be freely distributed under the MIT license.

src/gridstack.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// gridstack.ts 2.0.0-rc @preserve
1+
// gridstack.ts 2.0.0-rc2 @preserve
22

33
/**
44
* https://gridstackjs.com/
@@ -1214,10 +1214,11 @@ export class GridStack {
12141214
}
12151215

12161216
/** @internal prepares the element for drag&drop **/
1217-
private _prepareElementsByNode(el: GridItemHTMLElement, node: GridStackNode): GridStack {
1217+
private _prepareDragDropByNode(node: GridStackNode): GridStack {
12181218
// variables used/cashed between the 3 start/move/end methods, in addition to node passed above
12191219
let cellWidth: number;
12201220
let cellHeight: number;
1221+
let el = node.el;
12211222

12221223
/** called when item starts moving/resizing */
12231224
let onStartMoving = (event, ui) => {
@@ -1399,7 +1400,7 @@ export class GridStack {
13991400
node = this.engine.addNode(node, triggerAddEvent);
14001401
el.gridstackNode = node;
14011402

1402-
this._prepareElementsByNode(el, node);
1403+
this._prepareDragDropByNode(node);
14031404
return this;
14041405
}
14051406

@@ -1699,7 +1700,10 @@ export class GridStack {
16991700
}
17001701

17011702
// wait till we return out of the drag callback to set the new drag&resize handler or they may get messed up
1702-
window.setTimeout(() => this._prepareElementsByNode(el, node));
1703+
// IFF we are still there (soe application will use as placeholder and insert their real widget instead)
1704+
window.setTimeout(() => {
1705+
if (node.el && node.el.parentElement) this._prepareDragDropByNode(node);
1706+
});
17031707

17041708
return false; // prevent parent from receiving msg (which may be grid as well)
17051709
});

src/jq/gridstack-dd-jqueryui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// gridstack-dd-jqueryui.ts 2.0.0-rc @preserve
1+
// gridstack-dd-jqueryui.ts 2.0.0-rc2 @preserve
22

33
/** JQuery UI Drag&Drop plugin
44
* https://gridstackjs.com/

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// types.ts 2.0.0-rc @preserve
1+
// types.ts 2.0.0-rc2 @preserve
22

33
/**
44
* https://gridstackjs.com/

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// utils.ts 2.0.0-rc @preserve
1+
// utils.ts 2.0.0-rc2 @preserve
22

33
/**
44
* https://gridstackjs.com/

0 commit comments

Comments
 (0)