gridstack-js-rails 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e762ceab40dc8bc1cd9c0ec3fcdaf62ddb35b8c6
|
4
|
+
data.tar.gz: c4cc18c9f51f3ce42a539b70e075cc7e8d74f8d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fa0d7e9b947d93a5de54e42ec48b094d9bb2591e802abfd33440aff1050cced8bde7643acf66bd5cd79f5493029e8e7e3e301bf7cc14864864bd3d098973305
|
7
|
+
data.tar.gz: f5995ef16e05d03c6a4ed0324412768f277868290d2f8e2915cabb4d39f0864b0cf0aa6150533d0a55e743c47a50d5b77252e435670e48364fed5998a21459de
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* gridstack.js 0.2.
|
2
|
+
* gridstack.js 0.2.6
|
3
3
|
* http://troolee.github.io/gridstack.js/
|
4
4
|
* (c) 2014-2016 Pavel Reznikov
|
5
5
|
* gridstack.js may be freely distributed under the MIT license.
|
@@ -7,8 +7,12 @@
|
|
7
7
|
*/
|
8
8
|
(function(factory) {
|
9
9
|
if (typeof define === 'function' && define.amd) {
|
10
|
-
define(['jquery', 'lodash', 'jquery-ui/
|
11
|
-
'jquery-ui/
|
10
|
+
define(['jquery', 'lodash', 'jquery-ui/data', 'jquery-ui/disable-selection', 'jquery-ui/focusable',
|
11
|
+
'jquery-ui/form', 'jquery-ui/ie', 'jquery-ui/keycode', 'jquery-ui/labels', 'jquery-ui/jquery-1-7',
|
12
|
+
'jquery-ui/plugin', 'jquery-ui/safe-active-element', 'jquery-ui/safe-blur', 'jquery-ui/scroll-parent',
|
13
|
+
'jquery-ui/tabbable', 'jquery-ui/unique-id', 'jquery-ui/version', 'jquery-ui/widget',
|
14
|
+
'jquery-ui/widgets/mouse', 'jquery-ui/widgets/draggable', 'jquery-ui/widgets/droppable',
|
15
|
+
'jquery-ui/widgets/resizable'], factory);
|
12
16
|
} else if (typeof exports !== 'undefined') {
|
13
17
|
try { jQuery = require('jquery'); } catch (e) {}
|
14
18
|
try { _ = require('lodash'); } catch (e) {}
|
@@ -277,12 +281,14 @@
|
|
277
281
|
};
|
278
282
|
|
279
283
|
GridStackEngine.prototype._notify = function() {
|
284
|
+
var args = Array.prototype.slice.call(arguments, 0);
|
285
|
+
args[0] = typeof args[0] === 'undefined' ? [] : [args[0]];
|
286
|
+
args[1] = typeof args[1] === 'undefined' ? true : args[1];
|
280
287
|
if (this._updateCounter) {
|
281
288
|
return;
|
282
289
|
}
|
283
|
-
var deletedNodes =
|
284
|
-
|
285
|
-
this.onchange(deletedNodes);
|
290
|
+
var deletedNodes = args[0].concat(this.getDirtyNodes());
|
291
|
+
this.onchange(deletedNodes, args[1]);
|
286
292
|
};
|
287
293
|
|
288
294
|
GridStackEngine.prototype.cleanNodes = function() {
|
@@ -341,9 +347,7 @@
|
|
341
347
|
node._id = null;
|
342
348
|
this.nodes = _.without(this.nodes, node);
|
343
349
|
this._packNodes();
|
344
|
-
|
345
|
-
this._notify(node);
|
346
|
-
}
|
350
|
+
this._notify(node, detachNode);
|
347
351
|
};
|
348
352
|
|
349
353
|
GridStackEngine.prototype.canMoveNode = function(node, x, y, width, height) {
|
@@ -508,7 +512,7 @@
|
|
508
512
|
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
509
513
|
|
510
514
|
opts.itemClass = opts.itemClass || 'grid-stack-item';
|
511
|
-
var isNested = this.container.closest('.' + opts.itemClass).
|
515
|
+
var isNested = this.container.closest('.' + opts.itemClass).length > 0;
|
512
516
|
|
513
517
|
this.opts = _.defaults(opts || {}, {
|
514
518
|
width: parseInt(this.container.attr('data-gs-width')) || 12,
|
@@ -574,10 +578,11 @@
|
|
574
578
|
|
575
579
|
this._initStyles();
|
576
580
|
|
577
|
-
this.grid = new GridStackEngine(this.opts.width, function(nodes) {
|
581
|
+
this.grid = new GridStackEngine(this.opts.width, function(nodes, detachNode) {
|
582
|
+
detachNode = typeof detachNode === 'undefined' ? true : detachNode;
|
578
583
|
var maxHeight = 0;
|
579
584
|
_.each(nodes, function(n) {
|
580
|
-
if (n._id === null) {
|
585
|
+
if (detachNode && n._id === null) {
|
581
586
|
if (n.el) {
|
582
587
|
n.el.remove();
|
583
588
|
}
|
@@ -646,6 +651,8 @@
|
|
646
651
|
if (node.noResize || self.opts.disableResize) {
|
647
652
|
node.el.resizable('disable');
|
648
653
|
}
|
654
|
+
|
655
|
+
node.el.trigger('resize');
|
649
656
|
});
|
650
657
|
} else {
|
651
658
|
if (!oneColumnMode) {
|
@@ -665,6 +672,8 @@
|
|
665
672
|
if (!node.noResize && !self.opts.disableResize) {
|
666
673
|
node.el.resizable('enable');
|
667
674
|
}
|
675
|
+
|
676
|
+
node.el.trigger('resize');
|
668
677
|
});
|
669
678
|
}
|
670
679
|
};
|
@@ -672,7 +681,7 @@
|
|
672
681
|
$(window).resize(this.onResizeHandler);
|
673
682
|
this.onResizeHandler();
|
674
683
|
|
675
|
-
if (typeof self.opts.removable === 'string') {
|
684
|
+
if (!self.opts.staticGrid && typeof self.opts.removable === 'string') {
|
676
685
|
var trashZone = $(self.opts.removable);
|
677
686
|
if (!trashZone.data('droppable')) {
|
678
687
|
trashZone.droppable({
|
@@ -698,7 +707,7 @@
|
|
698
707
|
});
|
699
708
|
}
|
700
709
|
|
701
|
-
if (self.opts.acceptWidgets) {
|
710
|
+
if (!self.opts.staticGrid && self.opts.acceptWidgets) {
|
702
711
|
var draggingElement = null;
|
703
712
|
|
704
713
|
var onDrag = function(event, ui) {
|
@@ -797,7 +806,7 @@
|
|
797
806
|
.removeClass('ui-draggable ui-draggable-dragging ui-draggable-disabled')
|
798
807
|
.unbind('drag', onDrag);
|
799
808
|
self.container.append(el);
|
800
|
-
self.
|
809
|
+
self._prepareElementsByNode(el, node);
|
801
810
|
self._updateContainerHeight();
|
802
811
|
self._triggerChangeEvent();
|
803
812
|
|
@@ -965,7 +974,10 @@
|
|
965
974
|
node._isAboutToRemove = false;
|
966
975
|
};
|
967
976
|
|
968
|
-
GridStack.prototype.
|
977
|
+
GridStack.prototype._prepareElementsByNode = function(el, node) {
|
978
|
+
if (typeof $.ui === 'undefined') {
|
979
|
+
return;
|
980
|
+
}
|
969
981
|
var self = this;
|
970
982
|
|
971
983
|
var cellWidth;
|
@@ -1031,7 +1043,7 @@
|
|
1031
1043
|
var o = $(this);
|
1032
1044
|
self.grid.cleanNodes();
|
1033
1045
|
self.grid.beginUpdate(node);
|
1034
|
-
cellWidth =
|
1046
|
+
cellWidth = self.cellWidth();
|
1035
1047
|
var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
1036
1048
|
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
|
1037
1049
|
self.placeholder
|
@@ -1103,23 +1115,23 @@
|
|
1103
1115
|
};
|
1104
1116
|
|
1105
1117
|
el
|
1106
|
-
.draggable(_.extend(this.opts.draggable, {
|
1118
|
+
.draggable(_.extend({}, this.opts.draggable, {
|
1107
1119
|
containment: this.opts.isNested ? this.container.parent() : null,
|
1108
1120
|
start: onStartMoving,
|
1109
1121
|
stop: onEndMoving,
|
1110
1122
|
drag: dragOrResize
|
1111
1123
|
}))
|
1112
|
-
.resizable(_.extend(this.opts.resizable, {
|
1124
|
+
.resizable(_.extend({}, this.opts.resizable, {
|
1113
1125
|
start: onStartMoving,
|
1114
1126
|
stop: onEndMoving,
|
1115
1127
|
resize: dragOrResize
|
1116
1128
|
}));
|
1117
1129
|
|
1118
|
-
if (node.noMove || this._isOneColumnMode() || this.opts.
|
1130
|
+
if (node.noMove || this._isOneColumnMode() || this.opts.disableDrag) {
|
1119
1131
|
el.draggable('disable');
|
1120
1132
|
}
|
1121
1133
|
|
1122
|
-
if (node.noResize || this._isOneColumnMode() || this.opts.
|
1134
|
+
if (node.noResize || this._isOneColumnMode() || this.opts.disableResize) {
|
1123
1135
|
el.resizable('disable');
|
1124
1136
|
}
|
1125
1137
|
|
@@ -1151,7 +1163,7 @@
|
|
1151
1163
|
}, triggerAddEvent);
|
1152
1164
|
el.data('_gridstack_node', node);
|
1153
1165
|
|
1154
|
-
this.
|
1166
|
+
this._prepareElementsByNode(el, node);
|
1155
1167
|
};
|
1156
1168
|
|
1157
1169
|
GridStack.prototype.setAnimation = function(enable) {
|
@@ -1232,6 +1244,7 @@
|
|
1232
1244
|
this.disable();
|
1233
1245
|
if (typeof detachGrid != 'undefined' && !detachGrid) {
|
1234
1246
|
this.removeAll(false);
|
1247
|
+
this.container.removeData('gridstack');
|
1235
1248
|
} else {
|
1236
1249
|
this.container.remove();
|
1237
1250
|
}
|
@@ -1247,7 +1260,7 @@
|
|
1247
1260
|
el.each(function(index, el) {
|
1248
1261
|
el = $(el);
|
1249
1262
|
var node = el.data('_gridstack_node');
|
1250
|
-
if (typeof node == 'undefined' || node === null) {
|
1263
|
+
if (typeof node == 'undefined' || node === null || typeof $.ui === 'undefined') {
|
1251
1264
|
return;
|
1252
1265
|
}
|
1253
1266
|
|
@@ -1267,7 +1280,7 @@
|
|
1267
1280
|
el.each(function(index, el) {
|
1268
1281
|
el = $(el);
|
1269
1282
|
var node = el.data('_gridstack_node');
|
1270
|
-
if (typeof node == 'undefined' || node === null) {
|
1283
|
+
if (typeof node == 'undefined' || node === null || typeof $.ui === 'undefined') {
|
1271
1284
|
return;
|
1272
1285
|
}
|
1273
1286
|
|
@@ -1482,8 +1495,7 @@
|
|
1482
1495
|
};
|
1483
1496
|
|
1484
1497
|
GridStack.prototype.cellWidth = function() {
|
1485
|
-
|
1486
|
-
return Math.ceil(o.outerWidth() / parseInt(o.attr('data-gs-width'), 10));
|
1498
|
+
return Math.round(this.container.outerWidth() / this.opts.width);
|
1487
1499
|
};
|
1488
1500
|
|
1489
1501
|
GridStack.prototype.getCellFromPixel = function(position, useOffset) {
|
@@ -72,7 +72,7 @@
|
|
72
72
|
|
73
73
|
.grid-stack > .grid-stack-item > .ui-resizable-se,
|
74
74
|
.grid-stack > .grid-stack-item > .ui-resizable-sw {
|
75
|
-
background-image: url(data:image/svg+xml;
|
75
|
+
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
76
76
|
background-repeat: no-repeat;
|
77
77
|
background-position: center;
|
78
78
|
-webkit-transform: rotate(45deg);
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gridstack-js-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- randoum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lodash-rails
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.4.
|
112
|
+
rubygems_version: 2.4.5
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Wrap gridstack.js library and its dependencies for rails projects
|