Skip to content

Commit a858509

Browse files
authored
Merge pull request #1402 from adumesny/v2
v2.0.2
2 parents b9d33a7 + 32b62cd commit a858509

File tree

10 files changed

+104
-12
lines changed

10 files changed

+104
-12
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ alternatively in html
9696
or using CDN (minimized):
9797

9898
```html
99-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gridstack@2.0.1/dist/gridstack.min.css" />
100-
<script src="https://cdn.jsdelivr.net/npm/gridstack@2.0.1/dist/gridstack.all.js"></script>
99+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gridstack@2.0.2/dist/gridstack.min.css" />
100+
<script src="https://cdn.jsdelivr.net/npm/gridstack@2.0.2/dist/gridstack.all.js"></script>
101101
```
102102

103103
.map files are included for debugging purposes.
@@ -194,7 +194,7 @@ GridStack.init( {column: N} );
194194

195195
2) include `gridstack-extra.css` if **N < 12** (else custom CSS - see next). Without these, things will not render/work correctly.
196196
```html
197-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gridstack@2.0.1/dist/gridstack-extra.css"/>
197+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gridstack@2.0.2/dist/gridstack-extra.css"/>
198198

199199
<div class="grid-stack grid-stack-N">...</div>
200200
```

doc/CHANGES.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ Change log
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
66
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
77

8-
- [2.0.1-dev](#201-dev)
8+
- [2.0.2-dev](#202-dev)
9+
- [2.0.2 (2020-10-05)](#202-2020-10-05)
910
- [2.0.1 (2020-09-26)](#201-2020-09-26)
1011
- [2.0.0 (2020-09-07)](#200-2020-09-07)
1112
- [1.2.1 (2020-09-04)](#121-2020-09-04)
@@ -38,7 +39,11 @@ Change log
3839

3940
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
4041

41-
## 2.0.1-dev
42+
## 2.0.2-dev
43+
44+
- TBD
45+
46+
## 2.0.2 (2020-10-05)
4247

4348
- fix `animate` to not re-create CSS style each time (should be faster too) and made it default now since so much nicer. pass `{animate: false}` grid options if you want instant again [937](https://github.com/gridstack/gridstack.js/issues/937)
4449
- fix `resizable: { handles: ...}` forcing `alwaysShowResizeHandle` behavior [1373](https://github.com/gridstack/gridstack.js/issues/1373)

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.1-dev",
3+
"version": "2.0.2",
44
"description": "TypeScript/Javascript lib for dashboard layout and creation, no external dependencies, with many wrappers (React, Angular, Ember, knockout...)",
55
"main": "./dist/gridstack.js",
66
"types": "./dist/gridstack.d.ts",

src/dragdrop/dd-utils.ts

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
// dd-utils.ts 2.0.2 @preserve
2+
3+
/**
4+
* https://gridstackjs.com/
5+
* (c) 2020 Alain Dumesny, rhlin
6+
* gridstack.js may be freely distributed under the MIT license.
7+
*/
8+
export class DDUtils {
9+
static clone(el: HTMLElement): HTMLElement {
10+
const node = el.cloneNode(true) as HTMLElement;
11+
node.removeAttribute('id');
12+
return node;
13+
}
14+
15+
static appendTo(el: HTMLElement, parent: string | HTMLElement | Node) {
16+
let parentNode: HTMLElement;
17+
if (typeof parent === 'string') {
18+
parentNode = document.querySelector(parent as string);
19+
} else {
20+
parentNode = parent as HTMLElement;
21+
}
22+
if (parentNode) {
23+
parentNode.append(el);
24+
}
25+
}
26+
static setPositionRelative(el) {
27+
if (!(/^(?:r|a|f)/).test(window.getComputedStyle(el).position)) {
28+
el.style.position = "relative";
29+
}
30+
}
31+
32+
static throttle(callback: (...args) => void, delay: number) {
33+
let isWaiting = false;
34+
35+
return (...args) => {
36+
if (!isWaiting) {
37+
callback(...args);
38+
isWaiting = true;
39+
setTimeout(() => isWaiting = false, delay);
40+
}
41+
}
42+
}
43+
static addElStyles(el: HTMLElement, styles: { [prop: string]: string | string[] }) {
44+
if (styles instanceof Object) {
45+
for (const s in styles) {
46+
if (styles.hasOwnProperty(s)) {
47+
if (Array.isArray(styles[s])) {
48+
// support fallback value
49+
(styles[s] as string[]).forEach(val => {
50+
el.style[s] = val;
51+
});
52+
} else {
53+
el.style[s] = styles[s];
54+
}
55+
}
56+
}
57+
}
58+
}
59+
static copyProps(dst, src, props) {
60+
for (let i = 0; i < props.length; i++) {
61+
const p = props[i];
62+
dst[p] = src[p];
63+
}
64+
}
65+
66+
static initEvent<T>(e: DragEvent|MouseEvent, info: {type: string; target?: EventTarget}) {
67+
const kbdProps = 'altKey,ctrlKey,metaKey,shiftKey'.split(',');
68+
const ptProps = 'pageX,pageY,clientX,clientY,screenX,screenY'.split(',');
69+
const evt = {type: info.type};
70+
const obj = {
71+
button: 0,
72+
which: 0,
73+
buttons: 1,
74+
bubbles: true,
75+
cancelable: true,
76+
originEvent: e,
77+
target: info.target? info.target : e.target
78+
}
79+
if (e instanceof DragEvent) {
80+
Object.assign(obj, {dataTransfer: e.dataTransfer});
81+
}
82+
DDUtils.copyProps(evt, e, kbdProps);
83+
DDUtils.copyProps(evt, e, ptProps);
84+
DDUtils.copyProps(evt, obj, Object.keys(obj));
85+
return evt as unknown as T;
86+
}
87+
}

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.1-dev @preserve
1+
// gridstack-dd.ts 2.0.2 @preserve
22

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

src/gridstack-engine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// gridstack-engine.ts 2.0.1-dev @preserve
1+
// gridstack-engine.ts 2.0.2 @preserve
22

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

src/gridstack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// gridstack.ts 2.0.1-dev @preserve
1+
// gridstack.ts 2.0.2 @preserve
22

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

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.1-dev @preserve
1+
// gridstack-dd-jqueryui.ts 2.0.2 @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.1-dev @preserve
1+
// types.ts 2.0.2 @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.1-dev @preserve
1+
// utils.ts 2.0.2 @preserve
22

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

0 commit comments

Comments
 (0)