gridstack
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -15,3 +15,3 @@ /** | ||
export declare type DDOpts = 'enable' | 'disable' | 'destroy' | 'option' | string | any; | ||
export declare type DDKey = 'minWidth' | 'minHeight'; | ||
export declare type DDKey = 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight'; | ||
export declare type DDValue = number | string; | ||
@@ -18,0 +18,0 @@ /** drag&drop events callbacks */ |
"use strict"; | ||
// gridstack-GridStackDD.get().ts 3.1.0 @preserve | ||
// gridstack-GridStackDD.get().ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -34,2 +34,5 @@ /** | ||
* for static grid that don't do any of this work anyway. Saves about 10k. | ||
* TODO: no code hint in code below as this is <any> so look at alternatives ? | ||
* https://www.typescriptlang.org/docs/handbook/declaration-merging.html | ||
* https://www.typescriptlang.org/docs/handbook/mixins.html | ||
********************************************************************************/ | ||
@@ -46,7 +49,13 @@ /** @internal called to add drag over support to support widgets */ | ||
if (!node._added) { | ||
node._added = true; | ||
node.el = el; | ||
node.x = x; | ||
node.y = y; | ||
delete node.autoPosition; | ||
// don't accept *initial* location if doesn't fit #1419 (locked drop region, or can't grow), but maybe try if it will go somewhere | ||
if (!this.engine.willItFit(node)) { | ||
node.autoPosition = true; // ignore x,y and try for any slot... | ||
if (!this.engine.willItFit(node)) | ||
return; // full grid or can't grow | ||
} | ||
node._added = true; | ||
node.el = el; | ||
this.engine.cleanNodes(); | ||
@@ -83,17 +92,10 @@ this.engine.beginUpdate(node); | ||
// ignore drop enter on ourself, and prevent parent from receiving event | ||
let node = el.gridstackNode || {}; | ||
if (node.grid === this) { | ||
let node = el.gridstackNode; | ||
if (node && node.grid === this) { | ||
delete node._added; // reset this to track placeholder again in case we were over other grid #1484 (dropout doesn't always clear) | ||
return false; | ||
} | ||
// see if we already have a node with widget/height and check for attributes | ||
if (el.getAttribute && (!node.w || !node.h)) { | ||
let w = parseInt(el.getAttribute('gs-w')); | ||
if (w > 0) { | ||
node.w = w; | ||
} | ||
let h = parseInt(el.getAttribute('gs-h')); | ||
if (h > 0) { | ||
node.h = h; | ||
} | ||
// load any element attributes if we don't have a node | ||
if (!node) { | ||
node = this._readAttr(el); | ||
} | ||
@@ -139,2 +141,3 @@ // if the item came from another grid, let it know it was added here to removed duplicate shadow #393 | ||
let node = el.gridstackNode; | ||
let wasAdded = !!this.placeholder.parentElement; // skip items not actually added to us because of constrains, but do cleanup #1419 | ||
// ignore drop on ourself from ourself - dragend will handle the simple move instead | ||
@@ -148,3 +151,3 @@ if (node && node.grid === this) { | ||
delete el._gridstackNodeOrig; | ||
if (origNode && origNode.grid && origNode.grid !== this) { | ||
if (wasAdded && origNode && origNode.grid && origNode.grid !== this) { | ||
let oGrid = origNode.grid; | ||
@@ -156,10 +159,12 @@ oGrid.placeholder.remove(); | ||
} | ||
// use existing placeholder node as it's already in our list with drop location | ||
if (!node) { | ||
return false; | ||
} | ||
const _id = node._id; | ||
this.engine.cleanupNode(node); // removes all internal _xyz values (including the _id so add that back) | ||
node._id = _id; | ||
node.grid = this; | ||
// use existing placeholder node as it's already in our list with drop location | ||
if (wasAdded) { | ||
const _id = node._id; | ||
this.engine.cleanupNode(node); // removes all internal _xyz values (including the _id so add that back) | ||
node._id = _id; | ||
node.grid = this; | ||
} | ||
GridStackDD.get().off(el, 'drag'); | ||
@@ -171,3 +176,5 @@ // if we made a copy ('helper' which is temp) of the original node then insert a copy, else we move the original node (#1102) | ||
el.gridstackNode = origNode; // original item (left behind) is re-stored to pre dragging as the node now has drop info | ||
el = el.cloneNode(true); | ||
if (wasAdded) { | ||
el = el.cloneNode(true); | ||
} | ||
} | ||
@@ -178,2 +185,4 @@ else { | ||
} | ||
if (!wasAdded) | ||
return false; | ||
el.gridstackNode = node; | ||
@@ -313,2 +322,9 @@ node.el = el; | ||
GridStackDD.get().resizable(el, 'option', 'minHeight', cellHeight * (node.minH || 1)); | ||
// also set max if set #1330 | ||
if (node.maxW) { | ||
GridStackDD.get().resizable(el, 'option', 'maxWidth', cellWidth * node.maxW); | ||
} | ||
if (node.maxH) { | ||
GridStackDD.get().resizable(el, 'option', 'maxHeight', cellHeight * node.maxH); | ||
} | ||
}; | ||
@@ -327,5 +343,4 @@ /** called when item is being dragged/resized */ | ||
if (el.dataset.inTrashZone || x < 0 || x >= this.engine.column || y < 0 || (!this.engine.float && y > this.engine.getRow()) || node._added) { | ||
if (node._temporaryRemoved) { | ||
if (node._temporaryRemoved) | ||
return; | ||
} | ||
if (this.opts.removable === true) { | ||
@@ -354,2 +369,4 @@ this._setupRemovingTimeout(el); | ||
} | ||
if (node._lastTriedX === x && node._lastTriedY === y) | ||
return; | ||
} | ||
@@ -361,11 +378,7 @@ else if (event.type === 'resize') { | ||
h = Math.round(ui.size.height / cellHeight); | ||
if (w === node.w && h === node.h) | ||
return; | ||
} | ||
// width and height are undefined if not resizing | ||
let _lastTriedW = (w || node._lastTriedW); | ||
let _lastTriedH = (h || node._lastTriedH); | ||
if (!this.engine.canMoveNode(node, x, y, w, h) || | ||
(node._lastTriedX === x && node._lastTriedY === y && | ||
node._lastTriedW === _lastTriedW && node._lastTriedH === _lastTriedH)) { | ||
if (!this.engine.canMoveNode(node, x, y, w, h)) | ||
return; | ||
} | ||
node._lastTriedX = x; | ||
@@ -372,0 +385,0 @@ node._lastTriedY = y; |
"use strict"; | ||
// gridstack-ddi.ts 3.1.0 @preserve | ||
// gridstack-ddi.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ /** |
import { GridStackNode } from './types'; | ||
export declare type onChangeCB = (nodes: GridStackNode[], removeDOM?: boolean) => void; | ||
/** options used for creations - similar to GridStackOptions */ | ||
export interface GridStackEngineOptions { | ||
column?: number; | ||
maxRow?: number; | ||
float?: boolean; | ||
nodes?: GridStackNode[]; | ||
onChange?: onChangeCB; | ||
} | ||
/** | ||
@@ -13,7 +21,7 @@ * Defines the GridStack engine that does most no DOM grid manipulation. | ||
nodes: GridStackNode[]; | ||
onchange: onChangeCB; | ||
onChange: onChangeCB; | ||
addedNodes: GridStackNode[]; | ||
removedNodes: GridStackNode[]; | ||
batchMode: boolean; | ||
constructor(column?: number, onchange?: onChangeCB, float?: boolean, maxRow?: number, nodes?: GridStackNode[]); | ||
constructor(opts?: GridStackEngineOptions); | ||
batchUpdate(): GridStackEngine; | ||
@@ -39,4 +47,5 @@ commit(): GridStackEngine; | ||
canMoveNode(node: GridStackNode, x: number, y: number, w?: number, h?: number): boolean; | ||
canBePlacedWithRespectToHeight(node: GridStackNode): boolean; | ||
isNodeChangedPosition(node: GridStackNode, x: number, y: number, w: number, h: number): boolean; | ||
/** return true if can fit in grid height constrain only (always true if no maxRow) */ | ||
willItFit(node: GridStackNode): boolean; | ||
isNodeChangedPosition(node: GridStackNode, x: number, y: number, w?: number, h?: number): boolean; | ||
moveNode(node: GridStackNode, x: number, y: number, w?: number, h?: number, noPack?: boolean): GridStackNode; | ||
@@ -43,0 +52,0 @@ getRow(): number; |
"use strict"; | ||
// gridstack-engine.ts 3.1.0 @preserve | ||
// gridstack-engine.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -17,3 +17,3 @@ /** | ||
class GridStackEngine { | ||
constructor(column = 12, onchange, float = false, maxRow = 0, nodes = []) { | ||
constructor(opts = {}) { | ||
this.addedNodes = []; | ||
@@ -23,7 +23,7 @@ this.removedNodes = []; | ||
this.getGridHeight = utils_1.obsolete(this, GridStackEngine.prototype.getRow, 'getGridHeight', 'getRow', 'v1.0.0'); | ||
this.column = column; | ||
this.onchange = onchange; | ||
this._float = float; | ||
this.maxRow = maxRow; | ||
this.nodes = nodes; | ||
this.column = opts.column || 12; | ||
this.onChange = opts.onChange; | ||
this._float = opts.float; | ||
this.maxRow = opts.maxRow; | ||
this.nodes = opts.nodes || []; | ||
} | ||
@@ -292,4 +292,4 @@ batchUpdate() { | ||
let dirtyNodes = nodes.concat(this.getDirtyNodes()); | ||
if (this.onchange) { | ||
this.onchange(dirtyNodes, removeDOM); | ||
if (this.onChange) { | ||
this.onChange(dirtyNodes, removeDOM); | ||
} | ||
@@ -338,5 +338,4 @@ return this; | ||
node._id = null; // hint that node is being removed | ||
// TODO: .splice(findIndex(),1) would be faster but apparently there are cases we have 2 instances ! (see spec 'load add new, delete others') | ||
// this.nodes = this.nodes.filter(n => n !== node); | ||
this.nodes.splice(this.nodes.findIndex(n => n === node), 1); | ||
// don't use 'faster' .splice(findIndex(),1) in case node isn't in our list, or in multiple times. | ||
this.nodes = this.nodes.filter(n => n !== node); | ||
if (!this.float) { | ||
@@ -365,3 +364,3 @@ this._packNodes(); | ||
} | ||
let hasLocked = Boolean(this.nodes.find(n => n.locked)); | ||
let hasLocked = this.nodes.some(n => n.locked); | ||
if (!this.maxRow && !hasLocked) { | ||
@@ -371,29 +370,34 @@ return true; | ||
let clonedNode; | ||
let clone = new GridStackEngine(this.column, null, this.float, 0, this.nodes.map(n => { | ||
if (n === node) { | ||
clonedNode = Object.assign({}, n); | ||
return clonedNode; | ||
} | ||
return Object.assign({}, n); | ||
})); | ||
if (!clonedNode) { | ||
let clone = new GridStackEngine({ | ||
column: this.column, | ||
float: this.float, | ||
nodes: this.nodes.map(n => { | ||
if (n === node) { | ||
clonedNode = Object.assign({}, n); | ||
return clonedNode; | ||
} | ||
return Object.assign({}, n); | ||
}) | ||
}); | ||
if (!clonedNode) | ||
return true; | ||
} | ||
clone.moveNode(clonedNode, x, y, w, h); | ||
let canMove = true; | ||
if (hasLocked) { | ||
canMove = canMove && !Boolean(clone.nodes.find(n => { | ||
return n !== clonedNode && Boolean(n.locked) && Boolean(n._dirty); | ||
})); | ||
canMove = !clone.nodes.some(n => n.locked && n._dirty && n !== clonedNode); | ||
} | ||
if (this.maxRow) { | ||
canMove = canMove && (clone.getRow() <= this.maxRow); | ||
if (this.maxRow && canMove) { | ||
canMove = (clone.getRow() <= this.maxRow); | ||
} | ||
return canMove; | ||
} | ||
canBePlacedWithRespectToHeight(node) { | ||
if (!this.maxRow) { | ||
/** return true if can fit in grid height constrain only (always true if no maxRow) */ | ||
willItFit(node) { | ||
if (!this.maxRow) | ||
return true; | ||
} | ||
let clone = new GridStackEngine(this.column, null, this.float, 0, this.nodes.map(n => { return Object.assign({}, n); })); | ||
let clone = new GridStackEngine({ | ||
column: this.column, | ||
float: this.float, | ||
nodes: this.nodes.map(n => { return Object.assign({}, n); }) | ||
}); | ||
clone.addNode(node); | ||
@@ -400,0 +404,0 @@ return clone.getRow() <= this.maxRow; |
@@ -90,3 +90,3 @@ /** | ||
* Widget will be always placed even if result height is more than actual grid height. | ||
* You need to use willItFit method before calling addWidget for additional check. | ||
* You need to use `willItFit()` before calling addWidget for additional check. | ||
* See also `makeWidget()`. | ||
@@ -304,14 +304,9 @@ * | ||
/** | ||
* Returns true if the height of the grid will be less the vertical | ||
* Returns true if the height of the grid will be less than the vertical | ||
* constraint. Always returns true if grid doesn't have height constraint. | ||
* @param x new position x. If value is null or undefined it will be ignored. | ||
* @param y new position y. If value is null or undefined it will be ignored. | ||
* @param w new dimensions width. If value is null or undefined it will be ignored. | ||
* @param h new dimensions height. If value is null or undefined it will be ignored. | ||
* @param autoPosition if true then x, y parameters will be ignored and widget | ||
* will be places on the first available position | ||
* @param node contains x,y,w,h,auto-position options | ||
* | ||
* @example | ||
* if (grid.willItFit(newNode.x, newNode.y, newNode.w, newNode.h, newNode.autoPosition)) { | ||
* grid.addWidget(newNode); | ||
* if (grid.willItFit(newWidget)) { | ||
* grid.addWidget(newWidget); | ||
* } else { | ||
@@ -321,3 +316,3 @@ * alert('Not enough free space to place the widget'); | ||
*/ | ||
willItFit(x: number, y: number, w: number, h: number, autoPosition: boolean): boolean; | ||
willItFit(node: GridStackWidget): boolean; | ||
/** called to resize children nested grids when we/item resizes */ | ||
@@ -324,0 +319,0 @@ private _resizeNestedGrids; |
"use strict"; | ||
// gridstack.ts 3.1.0 @preserve | ||
// gridstack.ts 3.1.1 @preserve | ||
function __export(m) { | ||
@@ -137,19 +137,23 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
this._setStaticClass(); | ||
this._updateStyles(); | ||
this.engine = new gridstack_engine_1.GridStackEngine(this.opts.column, (cbNodes, removeDOM = true) => { | ||
let maxH = 0; | ||
this.engine.nodes.forEach(n => { maxH = Math.max(maxH, n.y + n.h); }); | ||
cbNodes.forEach(n => { | ||
let el = n.el; | ||
if (removeDOM && n._id === null) { | ||
if (el && el.parentNode) { | ||
el.parentNode.removeChild(el); | ||
this.engine = new gridstack_engine_1.GridStackEngine({ | ||
column: this.opts.column, | ||
float: this.opts.float, | ||
maxRow: this.opts.maxRow, | ||
onChange: (cbNodes, removeDOM = true) => { | ||
let maxH = 0; | ||
this.engine.nodes.forEach(n => { maxH = Math.max(maxH, n.y + n.h); }); | ||
cbNodes.forEach(n => { | ||
let el = n.el; | ||
if (removeDOM && n._id === null) { | ||
if (el && el.parentNode) { | ||
el.parentNode.removeChild(el); | ||
} | ||
} | ||
} | ||
else { | ||
this._writeAttrs(el, n.x, n.y, n.w, n.h); | ||
} | ||
}); | ||
this._updateStyles(false, maxH); // false = don't recreate, just append if need be | ||
}, this.opts.float, this.opts.maxRow); | ||
else { | ||
this._writeAttrs(el, n.x, n.y, n.w, n.h); | ||
} | ||
}); | ||
this._updateStyles(false, maxH); // false = don't recreate, just append if need be | ||
} | ||
}); | ||
if (this.opts.auto) { | ||
@@ -176,3 +180,3 @@ let elements = []; | ||
this.placeholder.appendChild(placeholderChild); | ||
this._updateContainerHeight(); | ||
this._updateStyles(); | ||
this._setupDragIn(); | ||
@@ -263,3 +267,3 @@ this._setupRemoveDrop(); | ||
* Widget will be always placed even if result height is more than actual grid height. | ||
* You need to use willItFit method before calling addWidget for additional check. | ||
* You need to use `willItFit()` before calling addWidget for additional check. | ||
* See also `makeWidget()`. | ||
@@ -311,3 +315,8 @@ * | ||
this._writeAttr(el, options); | ||
this.el.appendChild(el); | ||
if (this._insertNotAppend) { | ||
this.el.prepend(el); | ||
} | ||
else { | ||
this.el.appendChild(el); | ||
} | ||
// similar to makeWidget() that doesn't read attr again and worse re-create a new node and loose any _id | ||
@@ -381,2 +390,3 @@ this._prepareElement(el, true, options); | ||
let items = GridStack.Utils.sort(layout, -1, this._prevColumn || this.opts.column); | ||
this._insertNotAppend = true; // since create in reverse order... | ||
// if we're loading a layout into 1 column (_prevColumn is set only when going to 1) and items don't fit, make sure to save | ||
@@ -415,2 +425,3 @@ // the original wanted layout so we can scale back up correctly #1471 | ||
sub.gridstack.load(w.subGrid.children); // TODO: support updating grid options ? | ||
this._insertNotAppend = true; // got reset by above call | ||
} | ||
@@ -436,2 +447,3 @@ } | ||
delete this._ignoreLayoutsNodeChange; | ||
delete this._insertNotAppend; | ||
return this; | ||
@@ -488,3 +500,4 @@ } | ||
cellWidth() { | ||
return this.el.offsetWidth / this.opts.column; | ||
// use parent width if we're 0 (no size yet) | ||
return (this.el.offsetWidth || this.el.parentElement.offsetWidth || window.innerWidth) / this.opts.column; | ||
} | ||
@@ -968,14 +981,9 @@ /** | ||
/** | ||
* Returns true if the height of the grid will be less the vertical | ||
* Returns true if the height of the grid will be less than the vertical | ||
* constraint. Always returns true if grid doesn't have height constraint. | ||
* @param x new position x. If value is null or undefined it will be ignored. | ||
* @param y new position y. If value is null or undefined it will be ignored. | ||
* @param w new dimensions width. If value is null or undefined it will be ignored. | ||
* @param h new dimensions height. If value is null or undefined it will be ignored. | ||
* @param autoPosition if true then x, y parameters will be ignored and widget | ||
* will be places on the first available position | ||
* @param node contains x,y,w,h,auto-position options | ||
* | ||
* @example | ||
* if (grid.willItFit(newNode.x, newNode.y, newNode.w, newNode.h, newNode.autoPosition)) { | ||
* grid.addWidget(newNode); | ||
* if (grid.willItFit(newWidget)) { | ||
* grid.addWidget(newWidget); | ||
* } else { | ||
@@ -985,4 +993,11 @@ * alert('Not enough free space to place the widget'); | ||
*/ | ||
willItFit(x, y, w, h, autoPosition) { | ||
return this.engine.canBePlacedWithRespectToHeight({ x, y, w, h, autoPosition }); | ||
willItFit(node) { | ||
// support legacy call for now | ||
if (arguments.length > 1) { | ||
console.warn('gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon'); | ||
// eslint-disable-next-line prefer-rest-params | ||
let a = arguments, i = 0, w = { x: a[i++], y: a[i++], w: a[i++], h: a[i++], autoPosition: a[i++] }; | ||
return this.willItFit(w); | ||
} | ||
return this.engine.willItFit(node); | ||
} | ||
@@ -1052,3 +1067,4 @@ /** @internal */ | ||
this._updateContainerHeight(); | ||
if (!this.opts.cellHeight) { // The rest will be handled by CSS TODO: I don't understand this usage | ||
// if user is telling us they will handle the CSS themselves by setting heights to 0. Do we need this opts really ?? | ||
if (this.opts.cellHeight === 0) { | ||
return this; | ||
@@ -1179,3 +1195,3 @@ } | ||
this._writeAttrs(el, node.x, node.y, node.w, node.h); | ||
let attrs /*: GridStackWidget*/ = { | ||
let attrs /*: like GridStackWidget but strings */ = { | ||
autoPosition: 'gs-auto-position', | ||
@@ -1203,3 +1219,4 @@ minW: 'gs-min-w', | ||
/** @internal call to read any default attributes from element */ | ||
_readAttr(el, node = {}) { | ||
_readAttr(el) { | ||
let node = {}; | ||
node.x = utils_1.Utils.toNumber(el.getAttribute('gs-x')); | ||
@@ -1248,5 +1265,4 @@ node.y = utils_1.Utils.toNumber(el.getAttribute('gs-y')); | ||
onParentResize() { | ||
if (!this.el) { | ||
return; | ||
} // return if we're gone | ||
if (!this.el || !this.el.clientWidth) | ||
return; // return if we're gone or no size yet (will get called again) | ||
// make the cells content (minus margin) square again | ||
@@ -1253,0 +1269,0 @@ if (this._isAutoCellHeight) { |
"use strict"; | ||
// dd-base-impl.ts 3.1.0 @preserve | ||
// dd-base-impl.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ class DDBaseImplement { |
"use strict"; | ||
// dd-draggable.ts 3.1.0 @preserve | ||
// dd-draggable.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -82,10 +82,15 @@ /** | ||
} | ||
/** @internal */ | ||
/** @internal call when mouse goes down before a dragstart happens */ | ||
_mouseDown(event) { | ||
this.mouseDownElement = event.target; | ||
// make sure we are clicking on a drag handle or child of it... | ||
let className = this.option.handle.substring(1); | ||
let el = event.target; | ||
while (el && !el.classList.contains(className)) { | ||
el = el.parentElement; | ||
} | ||
this.mouseDownElement = el; | ||
} | ||
/** @internal */ | ||
_dragStart(event) { | ||
if (this.option.handle && !(this.mouseDownElement | ||
&& this.mouseDownElement.matches(`${this.option.handle}, ${this.option.handle} > *`))) { | ||
if (!this.mouseDownElement) { | ||
event.preventDefault(); | ||
@@ -92,0 +97,0 @@ return; |
"use strict"; | ||
// dd-droppable.ts 3.1.0 @preserve | ||
// dd-droppable.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ const dd_manager_1 = require("./dd-manager"); |
"use strict"; | ||
// dd-elements.ts 3.1.0 @preserve | ||
// dd-elements.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ /** |
"use strict"; | ||
// dd-manager.ts 3.1.0 @preserve | ||
// dd-manager.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ class DDManager { |
"use strict"; | ||
// dd-resizable-handle.ts 3.1.0 @preserve | ||
// dd-resizable-handle.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ class DDResizableHandle { |
"use strict"; | ||
// dd-resizable.ts 3.1.0 @preserve | ||
// dd-resizable.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -176,3 +176,3 @@ /** | ||
_setupHelper() { | ||
this.elOriginStyle = DDResizable._originStyleProp.map(prop => this.el.style[prop]); | ||
this.elOriginStyleVal = DDResizable._originStyleProp.map(prop => this.el.style[prop]); | ||
this.parentOriginStylePosition = this.el.parentElement.style.position; | ||
@@ -189,4 +189,4 @@ if (window.getComputedStyle(this.el.parentElement).position.match(/static/)) { | ||
_cleanHelper() { | ||
DDResizable._originStyleProp.forEach(prop => { | ||
this.el.style[prop] = this.elOriginStyle[prop] || null; | ||
DDResizable._originStyleProp.forEach((prop, i) => { | ||
this.el.style[prop] = this.elOriginStyleVal[i] || null; | ||
}); | ||
@@ -224,3 +224,3 @@ this.el.parentElement.style.position = this.parentOriginStylePosition || null; | ||
if (dir.indexOf('w') > -1) { | ||
newRect.left += reshape.width - newRect.width; | ||
newRect.left += newRect.width - reshape.width; | ||
} | ||
@@ -231,3 +231,3 @@ newRect.width = reshape.width; | ||
if (dir.indexOf('n') > -1) { | ||
newRect.top += reshape.height - newRect.height; | ||
newRect.top += newRect.height - reshape.height; | ||
} | ||
@@ -256,3 +256,5 @@ newRect.height = reshape.height; | ||
} | ||
Object.keys(this.temporalRect || this.originalRect).forEach(key => { | ||
if (!this.temporalRect) | ||
return this; | ||
Object.keys(this.temporalRect).forEach(key => { | ||
const value = this.temporalRect[key]; | ||
@@ -259,0 +261,0 @@ this.el.style[key] = value - containmentRect[key] + 'px'; |
"use strict"; | ||
// dd-utils.ts 3.1.0 @preserve | ||
// dd-utils.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ /** |
"use strict"; | ||
// gridstack-dd-native.ts 3.1.0 @preserve | ||
// gridstack-dd-native.ts 3.1.1 @preserve | ||
function __export(m) { | ||
@@ -4,0 +4,0 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; |
"use strict"; | ||
// gridstack-dd-jqueryui.ts 3.1.0 @preserve | ||
// gridstack-dd-jqueryui.ts 3.1.1 @preserve | ||
function __export(m) { | ||
@@ -4,0 +4,0 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; |
"use strict"; | ||
// types.ts 3.1.0 @preserve | ||
// types.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
//# sourceMappingURL=types.js.map |
"use strict"; | ||
// utils.ts 3.1.0 @preserve | ||
// utils.ts 3.1.1 @preserve | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -4,0 +4,0 @@ /** checks for obsolete method names */ |
@@ -8,3 +8,4 @@ Change log | ||
- [3.1.0](#310) | ||
- [3.1.1 (2020-12-7)](#311-2020-12-7) | ||
- [3.1.0 (2020-12-4)](#310-2020-12-4) | ||
- [3.0.0 (2020-11-29)](#300-2020-11-29) | ||
@@ -46,4 +47,16 @@ - [2.2.0 (2020-11-7)](#220-2020-11-7) | ||
## 3.1.0 | ||
## 3.1.1 (2020-12-7) | ||
- fix [1419](https://github.com/gridstack/gridstack.js/issues/1419) dragging into a fixed row grid works better (check if it will fit, else try to append, else won't insert) | ||
-- **possible BREAK** (unlikely you use engine directly) | ||
* engine constructor takes Options struct rather than spelling arguments (easier to extend/use) | ||
* `canBePlacedWithRespectToHeight()` -> `willItFit()` like grid method | ||
- fix [1330](https://github.com/gridstack/gridstack.js/issues/1330) `maxW` does not work as intended with resizable handle `"w"` | ||
- fix [1472](https://github.com/gridstack/gridstack.js/issues/1472) support all options for new dragged in widgets (read all `gs-xyz` attributes) | ||
- fix [1511](https://github.com/gridstack/gridstack.js/issues/1511) dragging any grid item content works | ||
- fix [1438](https://github.com/gridstack/gridstack.js/issues/1438) web-component fixes & grid with 0 size initially. | ||
## 3.1.0 (2020-12-4) | ||
- add new `addGrid(parent, opts)` to create a grid and load children instead of `init() + load()`, which is used by `load()` to supports nested grids creation. | ||
@@ -50,0 +63,0 @@ see [nested.html](https://github.com/gridstack/gridstack.js/blob/develop/demo/nested.html) demo. |
{ | ||
"name": "gridstack", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "TypeScript/Javascript lib for dashboard layout and creation, no external dependencies, with many wrappers (React, Angular, Ember, knockout...)", | ||
@@ -5,0 +5,0 @@ "main": "./dist/gridstack.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 3 instances in 1 package
3577110
0
100
70
6719