Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion demo/serialization.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ <h1>Serialization demo</h1>
});

grid.on('added removed change', function(e, items) {
if (!items) return;
let str = '';
items.forEach(function(item) { str += ' (x,y)=' + item.x + ',' + item.y; });
console.log(e.type + ' ' + items.length + ' items:' + str );
});

let serializedData = [
{x: 0, y: 0, w: 2, h: 2, id: '0'},
{x: 3, y: 1, h: 2, id: '1', content: "<button onclick=\"alert('clicked!')\">Press me</button>"},
{x: 3, y: 1, h: 2, id: '1', content: "<button onclick=\"alert('clicked!')\">Press me</button><div>text area</div><div><textarea></textarea></div><div>Input Field</div><input type='text'>"},
{x: 4, y: 1, id: '2'},
{x: 2, y: 3, w: 3, id: '3'},
{x: 1, y: 3, id: '4'}
Expand Down
5 changes: 5 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Change log
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*

- [7-dev (TBD)](#7-dev-tbd)
- [6.0.3-dev (2022-10-08)](#603-2022-10-08)
- [6.0.2 (2022-09-23)](#602-2022-09-23)
- [6.0.1 (2022-08-27)](#601-2022-08-27)
- [6.0.0 (2022-08-21)](#600-2022-08-21)
Expand Down Expand Up @@ -79,6 +80,10 @@ Thank you [StephanP] for sponsoring it.<br>
See [advance Nested](https://github.com/gridstack/gridstack.js/blob/master/demo/nested_advanced.html)
* add - ability to pause drag&drop collision until the user stops moving - see `DDDragOpt.pause` (used for creating nested grids on the fly based on gesture).

## 6.0.3-dev (2022-10-08)
* fixed [#2055](https://github.com/gridstack/gridstack.js/issues/2055) maxRow=1 resize outside (broke in 6.0.1)
* fixed [#2054](https://github.com/gridstack/gridstack.js/issues/2054) Can't enter text in textarea/input (broke in v6)

## 6.0.2 (2022-09-23)
* fixed [#2034](https://github.com/gridstack/gridstack.js/issues/2034) `removeWidget()` breaking resize handle feedback
* fixed [#2043](https://github.com/gridstack/gridstack.js/issues/2043) when swapping shapes in maxRow grid, make sure we still check for 50% coverage
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gridstack",
"version": "6.0.2-dev",
"version": "6.0.3-dev",
"description": "TypeScript/JS lib for dashboard layout and creation, no external dependencies, with many wrappers (React, Angular, Vue, Ember, knockout...)",
"main": "./dist/gridstack.js",
"types": "./dist/gridstack.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/dd-base-impl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* dd-base-impl.ts 6.0.2-dev
* dd-base-impl.ts 6.0.3-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
*/

Expand Down
19 changes: 13 additions & 6 deletions src/dd-draggable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* dd-draggable.ts 6.0.2-dev
* dd-draggable.ts 6.0.3-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
*/

Expand Down Expand Up @@ -129,12 +129,19 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
if (DDManager.mouseHandled) return;
if (e.button !== 0) return true; // only left click

// make sure we are not clicking on known object that handles mouseDown (TODO: make this extensible ?) #2054
const skipMouseDown = ['input', 'textarea', 'button', 'select', 'option'];
const name = (e.target as HTMLElement).nodeName.toLowerCase();
if (skipMouseDown.find(skip => skip === name)) return true;

// make sure we are clicking on a drag handle or child of it...
// Note: we don't need to check that's handle is an immediate child, as mouseHandled will prevent parents from also handling it (lowest wins)
let className = this.option.handle.substring(1);
let el = e.target as HTMLElement;
while (el && !el.classList.contains(className)) { el = el.parentElement; }
if (!el) return;
//
// REMOVE: why would we get the event if it wasn't for us or child ?
// let className = this.option.handle.substring(1);
// let el = e.target as HTMLElement;
// while (el && !el.classList.contains(className)) { el = el.parentElement; }
// if (!el) return;
this.mouseDownEvent = e;
delete this.dragging;
delete DDManager.dragElement;
Expand Down Expand Up @@ -201,7 +208,7 @@ export class DDDraggable extends DDBaseImplement implements HTMLElementExtendOpt
}
this.triggerEvent('dragstart', ev);
}
e.preventDefault();
e.preventDefault(); // needed otherwise we get text sweep text selection as we drag around
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/dd-droppable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* dd-droppable.ts 6.0.2-dev
* dd-droppable.ts 6.0.3-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
*/

Expand Down
2 changes: 1 addition & 1 deletion src/dd-element.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* dd-elements.ts 6.0.2-dev
* dd-elements.ts 6.0.3-dev
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
*/

Expand Down
4 changes: 2 additions & 2 deletions src/dd-gridstack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* dd-gridstack.ts 6.0.2-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
* dd-gridstack.ts 6.0.3-dev
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
*/

/* eslint-disable @typescript-eslint/no-unused-vars */
Expand Down
4 changes: 2 additions & 2 deletions src/dd-manager.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* dd-manager.ts 6.0.2-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
* dd-manager.ts 6.0.3-dev
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
*/

import { DDDraggable } from './dd-draggable';
Expand Down
2 changes: 1 addition & 1 deletion src/dd-resizable-handle.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* dd-resizable-handle.ts 6.0.2-dev
* dd-resizable-handle.ts 6.0.3-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
*/

Expand Down
2 changes: 1 addition & 1 deletion src/dd-resizable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* dd-resizable.ts 6.0.2-dev
* dd-resizable.ts 6.0.3-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
*/

Expand Down
2 changes: 1 addition & 1 deletion src/dd-touch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* touch.ts 6.0.2-dev
* touch.ts 6.0.3-dev
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
*/

Expand Down
10 changes: 5 additions & 5 deletions src/gridstack-engine.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* gridstack-engine.ts 6.0.2-dev
* gridstack-engine.ts 6.0.3-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
*/

Expand Down Expand Up @@ -560,10 +560,10 @@ export class GridStackEngine {
if (!clonedNode) return false;

// check if we're covering 50% collision and could move
let canMove = clone.moveNode(clonedNode, o);
// make sure we are still valid grid max, else check if we can force a swap (float=true, or different shapes) on non-resize
if (!o.resizing && canMove && o.collide && this.float && clone.getRow() > this.maxRow) {
let collide = o.collide.el.gridstackNode; // find the source node the clone collided with
let canMove = clone.moveNode(clonedNode, o) && clone.getRow() <= this.maxRow;
// else check if we can force a swap (float=true, or different shapes) on non-resize
if (!canMove && !o.resizing && o.collide) {
let collide = o.collide.el.gridstackNode; // find the source node the clone collided with at 50%
if (this.swap(node, collide)) { // swaps and mark dirty
this._notify();
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/gridstack-poly.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* gridstack-poly.ts 6.0.2-dev used for IE and older browser support (not supported in v2-v4.3.1, but again in v4.4)
* gridstack-poly.ts 6.0.3-dev used for IE and older browser support (not supported in v2-v4.3.1, but again in v4.4)
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
*/

Expand Down
4 changes: 2 additions & 2 deletions src/gridstack.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* gridstack SASS styles 6.0.2-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
* gridstack SASS styles 6.0.3-dev
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
*/

@use "sass:math";
Expand Down
4 changes: 2 additions & 2 deletions src/gridstack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* GridStack 6.0.2-dev
* GridStack 6.0.3-dev
* https://gridstackjs.com/
*
* Copyright (c) 2021-2022 Alain Dumesny
Expand Down Expand Up @@ -1575,7 +1575,7 @@ export class GridStack {
return this;
}

static GDRev = '6.0.2-dev';
static GDRev = '6.0.3-dev';

/*
* drag&drop empty stubs that will be implemented in dd-gridstack.ts for non static grid
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* types.ts 6.0.2-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
* types.ts 6.0.3-dev
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
*/

import { GridStack } from './gridstack';
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* utils.ts 6.0.2-dev
* Copyright (c) 2021-2022 Alain Dumesny - see GridStack root license
* utils.ts 6.0.3-dev
* Copyright (c) 2021 Alain Dumesny - see GridStack root license
*/

import { GridStackElement, GridStackNode, GridStackOptions, numberOrString, GridStackPosition, GridStackWidget } from './types';
Expand Down