diff --git a/demo/serialization.html b/demo/serialization.html index d420addbd..adaadace0 100644 --- a/demo/serialization.html +++ b/demo/serialization.html @@ -30,6 +30,7 @@

Serialization demo

}); 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 ); @@ -37,7 +38,7 @@

Serialization demo

let serializedData = [ {x: 0, y: 0, w: 2, h: 2, id: '0'}, - {x: 3, y: 1, h: 2, id: '1', content: ""}, + {x: 3, y: 1, h: 2, id: '1', content: "
text area
Input Field
"}, {x: 4, y: 1, id: '2'}, {x: 2, y: 3, w: 3, id: '3'}, {x: 1, y: 3, id: '4'} diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 96dc5dfd1..814d8c5d7 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -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) @@ -79,6 +80,10 @@ Thank you [StephanP] for sponsoring it.
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 diff --git a/package.json b/package.json index 4ffc5eabb..836966d76 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/dd-base-impl.ts b/src/dd-base-impl.ts index 1cbe57d66..fa9890db5 100644 --- a/src/dd-base-impl.ts +++ b/src/dd-base-impl.ts @@ -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 */ diff --git a/src/dd-draggable.ts b/src/dd-draggable.ts index 8c40b18f2..436a553af 100644 --- a/src/dd-draggable.ts +++ b/src/dd-draggable.ts @@ -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 */ @@ -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; @@ -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; } diff --git a/src/dd-droppable.ts b/src/dd-droppable.ts index 75254be37..693061197 100644 --- a/src/dd-droppable.ts +++ b/src/dd-droppable.ts @@ -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 */ diff --git a/src/dd-element.ts b/src/dd-element.ts index c49b2fb37..acb4c16a5 100644 --- a/src/dd-element.ts +++ b/src/dd-element.ts @@ -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 */ diff --git a/src/dd-gridstack.ts b/src/dd-gridstack.ts index a278baec0..6c7478180 100644 --- a/src/dd-gridstack.ts +++ b/src/dd-gridstack.ts @@ -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 */ diff --git a/src/dd-manager.ts b/src/dd-manager.ts index 4cd716980..fd3aea83a 100644 --- a/src/dd-manager.ts +++ b/src/dd-manager.ts @@ -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'; diff --git a/src/dd-resizable-handle.ts b/src/dd-resizable-handle.ts index 9fa1e8b44..c01e8e8c5 100644 --- a/src/dd-resizable-handle.ts +++ b/src/dd-resizable-handle.ts @@ -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 */ diff --git a/src/dd-resizable.ts b/src/dd-resizable.ts index f45d0d483..bb83cf1c6 100644 --- a/src/dd-resizable.ts +++ b/src/dd-resizable.ts @@ -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 */ diff --git a/src/dd-touch.ts b/src/dd-touch.ts index 61b1796bb..caf81b98c 100644 --- a/src/dd-touch.ts +++ b/src/dd-touch.ts @@ -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 */ diff --git a/src/gridstack-engine.ts b/src/gridstack-engine.ts index 11b3f8d14..a0718ea97 100644 --- a/src/gridstack-engine.ts +++ b/src/gridstack-engine.ts @@ -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 */ @@ -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; diff --git a/src/gridstack-poly.js b/src/gridstack-poly.js index 486b49751..891cb0c4c 100644 --- a/src/gridstack-poly.js +++ b/src/gridstack-poly.js @@ -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 */ diff --git a/src/gridstack.scss b/src/gridstack.scss index 3e21864f3..d9c06bbd8 100644 --- a/src/gridstack.scss +++ b/src/gridstack.scss @@ -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"; diff --git a/src/gridstack.ts b/src/gridstack.ts index 5418360bb..e8eaf1fe5 100644 --- a/src/gridstack.ts +++ b/src/gridstack.ts @@ -1,5 +1,5 @@ /*! - * GridStack 6.0.2-dev + * GridStack 6.0.3-dev * https://gridstackjs.com/ * * Copyright (c) 2021-2022 Alain Dumesny @@ -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 diff --git a/src/types.ts b/src/types.ts index e229acf2c..dbac562c9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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'; diff --git a/src/utils.ts b/src/utils.ts index 25b1f7a0c..53001c53e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -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';