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
2 changes: 1 addition & 1 deletion dist/gridstack-extra.min.css

Large diffs are not rendered by default.

26 changes: 23 additions & 3 deletions dist/gridstack.all.js

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion dist/gridstack.jQueryUI.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 32 additions & 8 deletions dist/gridstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,25 @@
height = parseFloat(match[1]);
}
return {height: height, unit: heightUnit};
},

removePositioningStyles: function(el) {
var style = el[0].style;
if (style.position) {
style.removeProperty('position');
}
if (style.left) {
style.removeProperty('left');
}
if (style.top) {
style.removeProperty('top');
}
if (style.width) {
style.removeProperty('width');
}
if (style.height) {
style.removeProperty('height');
}
}
};

Expand Down Expand Up @@ -869,13 +888,14 @@
$(ui.helper).remove();
node.el = el;
self.placeholder.hide();
Utils.removePositioningStyles(el);

el
.attr('data-gs-x', node.x)
.attr('data-gs-y', node.y)
.attr('data-gs-width', node.width)
.attr('data-gs-height', node.height)
.addClass(self.opts.itemClass)
.removeAttr('style')
.enableSelection()
.removeData('draggable')
.removeClass('ui-draggable ui-draggable-dragging ui-draggable-disabled')
Expand Down Expand Up @@ -947,14 +967,14 @@
if (typeof maxHeight == 'undefined') {
maxHeight = this._styles._max;
}
if (this._styles._max !== 0 && maxHeight <= this._styles._max) { // Keep this._styles._max increasing
return ;
}
this._initStyles();
this._updateContainerHeight();
if (!this.opts.cellHeight) { // The rest will be handled by CSS
return ;
}
if (this._styles._max !== 0 && maxHeight <= this._styles._max) {
return ;
}

if (!this.opts.verticalMargin || this.opts.cellHeightUnit === this.opts.verticalMarginUnit) {
getHeight = function(nbRows, nbMargins) {
Expand Down Expand Up @@ -1008,6 +1028,10 @@
return;
}
var height = this.grid.getGridHeight();
var minHeight = parseInt(this.container.css('min-height')) / this.cellHeight();
if (height < minHeight) {
height = minHeight;
}
this.container.attr('data-gs-current-height', height);
if (!this.opts.cellHeight) {
return ;
Expand Down Expand Up @@ -1170,19 +1194,19 @@
} else {
self._clearRemovingTimeout(el);
if (!node._temporaryRemoved) {
Utils.removePositioningStyles(o);
o
.attr('data-gs-x', node.x)
.attr('data-gs-y', node.y)
.attr('data-gs-width', node.width)
.attr('data-gs-height', node.height)
.removeAttr('style');
.attr('data-gs-height', node.height);
} else {
Utils.removePositioningStyles(o);
o
.attr('data-gs-x', node._beforeDragX)
.attr('data-gs-y', node._beforeDragY)
.attr('data-gs-width', node.width)
.attr('data-gs-height', node.height)
.removeAttr('style');
.attr('data-gs-height', node.height);
node.x = node._beforeDragX;
node.y = node._beforeDragY;
self.grid.addNode(node);
Expand Down
2 changes: 1 addition & 1 deletion dist/gridstack.min.css

Large diffs are not rendered by default.

20 changes: 18 additions & 2 deletions dist/gridstack.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/gridstack.min.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Change log
- widgets can have their own resize handles. Use `data-gs-resize-handles` element attribute to use. For example, `data-gs-resize-handles="e,w"` will make the particular widget only resize west and east. ([#494](https://github.com/troolee/gridstack.js/issues/494)).
- enable sidebar items to be duplicated properly. Pass `helper: 'clone'` in `draggable` options. ([#661](https://github.com/troolee/gridstack.js/issues/661), ([#396](https://github.com/troolee/gridstack.js/issues/396), ([#499](https://github.com/troolee/gridstack.js/issues/499)).
- fix `staticGrid` grid option ([#743](https://github.com/troolee/gridstack.js/issues/743))
- preserve inline styles when moving/cloning items (thanks silverwind)
- fix bug causing heights not to get set ([#744](https://github.com/troolee/gridstack.js/issues/744))
- allow grid to have min-height, fixes ([#628](https://github.com/troolee/gridstack.js/issues/628))

## v0.3.0 (2017-04-21)

Expand Down
24 changes: 20 additions & 4 deletions src/gridstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,22 @@
},

removePositioningStyles: function(el) {
var style = el[0].style;
if (style.position) style.removeProperty('position');
if (style.left) style.removeProperty('left');
if (style.top) style.removeProperty('top');
var style = el[0].style;
if (style.position) {
style.removeProperty('position');
}
if (style.left) {
style.removeProperty('left');
}
if (style.top) {
style.removeProperty('top');
}
if (style.width) {
style.removeProperty('width');
}
if (style.height) {
style.removeProperty('height');
}
}
};

Expand Down Expand Up @@ -1016,6 +1028,10 @@
return;
}
var height = this.grid.getGridHeight();
var minHeight = parseInt(this.container.css('min-height')) / this.cellHeight();
if (height < minHeight) {
height = minHeight;
}
this.container.attr('data-gs-current-height', height);
if (!this.opts.cellHeight) {
return ;
Expand Down