Compare commits
132 commits
Author | SHA1 | Date | |
---|---|---|---|
c1c4ff8e92 | |||
ff547b5ba0 | |||
b0e68cafca | |||
9007eeafe7 | |||
6d5f189613 | |||
016c1610bc | |||
bd8bbfff2a | |||
4383fc846d | |||
2f2c6bbaf4 | |||
5cf92a3c62 | |||
215a6f16a2 | |||
8a554b37c5 | |||
8dc5916896 | |||
79d9b423ce | |||
0102470f65 | |||
6ebd7a2005 | |||
ca95e7ba49 | |||
6e4c6d2645 | |||
a749a930c0 | |||
999020bcff | |||
5bc7d51959 | |||
6ca195271f | |||
46b857a443 | |||
6122ca4d27 | |||
e9460847ce | |||
56d9ec325d | |||
bc4d07687a | |||
625a8378b4 | |||
a9a332cd8f | |||
3f193dbb3a | |||
7cb3da3878 | |||
6d8ce2299c | |||
eeff06dbe8 | |||
0b3b47cefe | |||
67dc2dd85c | |||
64ea5c4cf6 | |||
78f00738ab | |||
30b096d5f9 | |||
01a27c6ed9 | |||
f1cdbe27c9 | |||
af0f2d235b | |||
76164595fe | |||
f8b56af17b | |||
d3db46a3a5 | |||
a219accfa3 | |||
075c06f38e | |||
39ffe9ca3d | |||
eebc0b15a6 | |||
5c605e48b7 | |||
28ed6fa374 | |||
a064a2ee6b | |||
3928d05109 | |||
0d7c8edc92 | |||
4ae4540bba | |||
12605cceeb | |||
8f072be871 | |||
75e936314b | |||
5c4e44ef23 | |||
9c0bcd74e7 | |||
042ba6a887 | |||
ceaffa8f54 | |||
723cb235b9 | |||
137fe18995 | |||
ceef60d356 | |||
07ff68010e | |||
fcd2327194 | |||
703c52dc59 | |||
d47ad9cd21 | |||
11b6292d31 | |||
b09ae61fe2 | |||
696b0f7ca8 | |||
56801119c2 | |||
a04a247743 | |||
34213e6fe9 | |||
dbe642f294 | |||
491388379c | |||
0c424c2637 | |||
c0704f18d4 | |||
1079cd4c1c | |||
5498ce2bae | |||
669c6747f2 | |||
cb7e0bdeb4 | |||
7f1d362a29 | |||
62f07b2da1 | |||
2de0c4ee00 | |||
020523855e | |||
9cc4396f2e | |||
d909458602 | |||
8f69732dda | |||
d3b77baf8c | |||
f29236a78f | |||
6579b4c93d | |||
8c240d1e83 | |||
cabb0b886a | |||
8ea6b706ba | |||
47fbdd1ff3 | |||
9a9e8ece7e | |||
d7a4171b54 | |||
4c3abe8e63 | |||
fb157a3dd2 | |||
0336d2401e | |||
f0c76130e7 | |||
9fecc0dcb5 | |||
69ebbdbae5 | |||
c9971a69a4 | |||
99653bded3 | |||
acaec8d429 | |||
35b9c6a6c2 | |||
4399e1a455 | |||
94b249c77d | |||
0a5d67cfc8 | |||
f20fb331c9 | |||
cad14ab88e | |||
61ed99ab5c | |||
0c409773a7 | |||
cc9271bcb5 | |||
08f8b1d118 | |||
2c71ce639c | |||
f04965a78e | |||
90838740b0 | |||
7b1f147283 | |||
0c0b7793dd | |||
fa9736ee84 | |||
0318e3a922 | |||
2f29a71c8f | |||
d06834c5cc | |||
01c7607d0b | |||
19a52197c2 | |||
a3babd353c | |||
376a5f2945 | |||
61fc120b11 | |||
205df5ded4 |
15
.bithoundrc
Normal file
15
.bithoundrc
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"ignore": [
|
||||
"dist/**",
|
||||
"**/node_modules/**",
|
||||
"**/bower_components/**",
|
||||
"**/demo/**",
|
||||
"**/coverage/**"
|
||||
],
|
||||
"test": [
|
||||
"**/spec/**"
|
||||
],
|
||||
"critics": {
|
||||
"lint": "jshint"
|
||||
}
|
||||
}
|
50
.travis.yml
50
.travis.yml
|
@ -1,35 +1,31 @@
|
|||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "5.7.0"
|
||||
|
||||
- 5.7.0
|
||||
env:
|
||||
- CXX=g++-4.8
|
||||
|
||||
- CXX=g++-4.8
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.8
|
||||
before_install:
|
||||
- npm install -g protractor
|
||||
|
||||
- npm install -g protractor
|
||||
install:
|
||||
- npm install -g npm@2
|
||||
- npm install -g grunt-cli
|
||||
- npm install -g bower
|
||||
- bower install
|
||||
- npm install
|
||||
- ./node_modules/protractor/bin/webdriver-manager update --standalone
|
||||
|
||||
- npm install -g npm@2
|
||||
- npm install -g grunt-cli
|
||||
- npm install -g bower
|
||||
- bower install
|
||||
- npm install
|
||||
- ./node_modules/protractor/bin/webdriver-manager update --standalone
|
||||
before_script:
|
||||
- export CHROME_BIN=chromium-browser
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
|
||||
- export CHROME_BIN=chromium-browser
|
||||
- export DISPLAY=:99.0
|
||||
- sh -e /etc/init.d/xvfb start
|
||||
script:
|
||||
- npm run build
|
||||
- npm test
|
||||
- grunt e2e-test
|
||||
- npm run build
|
||||
- npm test
|
||||
- grunt e2e-test
|
||||
notifications:
|
||||
slack:
|
||||
secure: iGLGsYyVIyKVpVVCskGh/zc6Pkqe0D7jpUtbywSbnq6l5seE6bvBVqm0F2FSCIN+AIC+qal2mPEWysDVsLACm5tTEeA8NfL8dmCrAKbiFbi+gHl4mnHHCHl7ii/7UkoIIXNc5UXbgMSXRS5l8UcsSDlN8VxC5zWstbJvjeYIvbA=
|
||||
|
|
14
Gruntfile.js
14
Gruntfile.js
|
@ -37,7 +37,8 @@ module.exports = function(grunt) {
|
|||
copy: {
|
||||
dist: {
|
||||
files: {
|
||||
'dist/gridstack.js': ['src/gridstack.js']
|
||||
'dist/gridstack.js': ['src/gridstack.js'],
|
||||
'dist/gridstack.jQueryUI.js': ['src/gridstack.jQueryUI.js'],
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -50,7 +51,9 @@ module.exports = function(grunt) {
|
|||
},
|
||||
dist: {
|
||||
files: {
|
||||
'dist/gridstack.min.js': ['src/gridstack.js']
|
||||
'dist/gridstack.min.js': ['src/gridstack.js'],
|
||||
'dist/gridstack.jQueryUI.min.js': ['src/gridstack.jQueryUI.js'],
|
||||
'dist/gridstack.all.js': ['src/gridstack.js', 'src/gridstack.jQueryUI.js']
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -69,6 +72,11 @@ module.exports = function(grunt) {
|
|||
target: './doc/README.md'
|
||||
}
|
||||
},
|
||||
faq: {
|
||||
options: {
|
||||
target: './doc/FAQ.md'
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
jshint: {
|
||||
|
@ -93,7 +101,7 @@ module.exports = function(grunt) {
|
|||
},
|
||||
},
|
||||
docs: {
|
||||
files: ['README.md', 'doc/README.md'],
|
||||
files: ['README.md', 'doc/README.md', 'doc/FAQ.md'],
|
||||
tasks: ['doctoc'],
|
||||
options: {
|
||||
},
|
||||
|
|
3
LICENSE
3
LICENSE
|
@ -1,6 +1,6 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016 Pavel Reznikov
|
||||
Copyright (c) 2014-2016 Pavel Reznikov, Dylan Weiss
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
|
78
README.md
78
README.md
|
@ -10,7 +10,7 @@ gridstack.js
|
|||
gridstack.js is a jQuery plugin for widget layout. This is drag-and-drop multi-column grid. It allows you to build
|
||||
draggable responsive bootstrap v3 friendly layouts. It also works great with [knockout.js](http://knockoutjs.com), [angular.js](https://angularjs.org) and touch devices.
|
||||
|
||||
Inspired by [gridster.js](http://gridster.net). Built with love.
|
||||
Inspired by [gridster.js](https://github.com/ducksboard/gridster.js). Built with love.
|
||||
|
||||
Join gridstack.js on Slack: https://gridstackjs.troolee.com
|
||||
|
||||
|
@ -23,10 +23,13 @@ Join gridstack.js on Slack: https://gridstackjs.troolee.com
|
|||
- [Demo](#demo)
|
||||
- [Usage](#usage)
|
||||
- [Requirements](#requirements)
|
||||
- [Using gridstack.js with jQuery UI](#using-gridstackjs-with-jquery-ui)
|
||||
- [Install](#install)
|
||||
- [Basic usage](#basic-usage)
|
||||
- [Migrating to v0.3.0](#migrating-to-v030)
|
||||
- [Migrating to v0.2.5](#migrating-to-v025)
|
||||
- [API Documentation](#api-documentation)
|
||||
- [Questions and Answers](#questions-and-answers)
|
||||
- [Touch devices support](#touch-devices-support)
|
||||
- [Use with knockout.js](#use-with-knockoutjs)
|
||||
- [Use with angular.js](#use-with-angularjs)
|
||||
|
@ -44,6 +47,8 @@ Join gridstack.js on Slack: https://gridstackjs.troolee.com
|
|||
- [Using AniJS](#using-anijs)
|
||||
- [The Team](#the-team)
|
||||
- [Changes](#changes)
|
||||
- [v0.3.0-dev (Development Version)](#v030-dev-development-version)
|
||||
- [v0.2.6 (2016-08-17)](#v026-2016-08-17)
|
||||
- [v0.2.5 (2016-03-02)](#v025-2016-03-02)
|
||||
- [v0.2.4 (2016-02-15)](#v024-2016-02-15)
|
||||
- [v0.2.3 (2015-06-23)](#v023-2015-06-23)
|
||||
|
@ -59,7 +64,7 @@ Join gridstack.js on Slack: https://gridstackjs.troolee.com
|
|||
Demo
|
||||
====
|
||||
|
||||
Please visit http://troolee.github.io/gridstack.js/ for demo.
|
||||
Please visit http://troolee.github.io/gridstack.js/ for demo. Or check out [these example](http://troolee.github.io/gridstack.js/demo/).
|
||||
|
||||
|
||||
Usage
|
||||
|
@ -67,20 +72,29 @@ Usage
|
|||
|
||||
## Requirements
|
||||
|
||||
* [lodash.js](https://lodash.com) (>= 3.5.0)
|
||||
* [jQuery](http://jquery.com) (>= 1.11.0)
|
||||
* [jQuery UI](http://jqueryui.com) (>= 1.11.0). Minimum required components: Core, Widget, Mouse, Draggable, Resizable
|
||||
* (Optional) [jquery-ui-touch-punch](https://github.com/furf/jquery-ui-touch-punch) for touch-based devices support
|
||||
* [lodash.js](https://lodash.com) (>= 3.5.0, full build)
|
||||
* [jQuery](http://jquery.com) (>= 3.1.0)
|
||||
|
||||
Note: You can still use [underscore.js](http://underscorejs.org) (>= 1.7.0) instead of lodash.js
|
||||
|
||||
#### Using gridstack.js with jQuery UI
|
||||
|
||||
* [jQuery UI](http://jqueryui.com) (>= 1.12.0). Minimum required components: Core, Widget, Mouse, Draggable, Resizable
|
||||
* (Optional) [jquery-ui-touch-punch](https://github.com/furf/jquery-ui-touch-punch) for touch-based devices support
|
||||
|
||||
## Install
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="gridstack.css" />
|
||||
<script src="gridstack.js"></script>
|
||||
<script src="gridstack.jQueryUI.js"></script>
|
||||
```
|
||||
|
||||
* Using CDN:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.4/gridstack.min.css" />
|
||||
<script type="text/javascript" src='//cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.4/gridstack.min.js'></script>
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.6/gridstack.min.css" />
|
||||
<script type="text/javascript" src='//cdnjs.cloudflare.com/ajax/libs/gridstack.js/0.2.6/gridstack.min.js'></script>
|
||||
```
|
||||
|
||||
* Using bower:
|
||||
|
@ -126,6 +140,25 @@ $(function () {
|
|||
</script>
|
||||
```
|
||||
|
||||
## Migrating to v0.3.0
|
||||
|
||||
As of v0.3.0, gridstack introduces a new plugin system. The drag'n'drop functionality has been modified to take advantage of this system. Because of this, and to avoid dependency on core code from jQuery UI, the plugin was functionality was moved to a separate file.
|
||||
|
||||
To ensure gridstack continues to work, either include the additional `gridstack.jQueryUI.js` file into your HTML or use `gridstack.all.js`:
|
||||
|
||||
```html
|
||||
<script src="gridstack.js"></script>
|
||||
<script src="gridstack.jQueryUI.js"></script>
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```html
|
||||
<script src="gridstack.all.js"></script>
|
||||
```
|
||||
|
||||
We're working on implementing support for other drag'n'drop libraries through the new plugin system.
|
||||
|
||||
## Migrating to v0.2.5
|
||||
|
||||
As of v0.2.5 all methods and parameters are in camel case to respect [JavaScript Style Guide and Coding Conventions](http://www.w3schools.com/js/js_conventions.asp).
|
||||
|
@ -136,6 +169,13 @@ when they will be completely removed.
|
|||
|
||||
Please check out `doc/README.md` for more information about gridstack.js API.
|
||||
|
||||
## Questions and Answers
|
||||
|
||||
Please feel free to as a questions here in issues, using [Stackoverflow](http://stackoverflow.com/search?q=gridstack) or [Slack chat](https://gridstackjs.troolee.com).
|
||||
We will glad to answer and help you as soon as we can.
|
||||
|
||||
Also please check our FAQ `doc/FAQ.md` before asking in case the answer is already there.
|
||||
|
||||
## Touch devices support
|
||||
|
||||
Please use [jQuery UI Touch Punch](https://github.com/furf/jquery-ui-touch-punch) to make jQuery UI Draggable/Resizable
|
||||
|
@ -161,6 +201,8 @@ $(function () {
|
|||
});
|
||||
```
|
||||
|
||||
If you're still experiencing issues on touch devices please check [#444](https://github.com/troolee/gridstack.js/issues/444)
|
||||
|
||||
## Use with knockout.js
|
||||
|
||||
```javascript
|
||||
|
@ -465,6 +507,24 @@ for help.
|
|||
Changes
|
||||
=======
|
||||
|
||||
#### v0.3.0-dev (Development Version)
|
||||
|
||||
- add oneColumnModeClass option to grid.
|
||||
- remove 768px CSS styles, moved to grid-stack-one-column-mode class.
|
||||
- add max-width override on grid-stck-one-column-mode ([#462](https://github.com/troolee/gridstack.js/issues/462)).
|
||||
- add internal function`isNodeChangedPosition`, minor optimization to move/drag.
|
||||
- drag'n'drop plugin system. Move jQuery UI dependencies to separate plugin file.
|
||||
|
||||
#### v0.2.6 (2016-08-17)
|
||||
|
||||
- update requirements to the latest versions of jQuery (v3.1.0+) and jquery-ui (v1.12.0+).
|
||||
- fix jQuery `size()` ([#486](https://github.com/troolee/gridstack.js/issues/486)).
|
||||
- update `destroy([detachGrid])` call ([#422](https://github.com/troolee/gridstack.js/issues/422)).
|
||||
- don't mutate options when calling `draggable` and `resizable`. ([#505](https://github.com/troolee/gridstack.js/issues/505)).
|
||||
- update _notify to allow detach ([#411](https://github.com/troolee/gridstack.js/issues/411)).
|
||||
- fix code that checks for jquery-ui ([#481](https://github.com/troolee/gridstack.js/issues/481)).
|
||||
- fix `cellWidth` calculation on empty grid
|
||||
|
||||
#### v0.2.5 (2016-03-02)
|
||||
|
||||
- update names to respect js naming convention.
|
||||
|
@ -555,7 +615,7 @@ License
|
|||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016 Pavel Reznikov
|
||||
Copyright (c) 2014-2016 Pavel Reznikov, Dylan Weiss
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gridstack",
|
||||
"version": "0.2.5",
|
||||
"version": "0.3.0-dev",
|
||||
"homepage": "https://github.com/troolee/gridstack.js",
|
||||
"authors": [
|
||||
"Pavel Reznikov <pashka.reznikov@gmail.com>"
|
||||
|
@ -14,9 +14,9 @@
|
|||
"amd"
|
||||
],
|
||||
"dependencies": {
|
||||
"lodash": ">= 3.5.0",
|
||||
"jquery": ">= 1.11.0",
|
||||
"jquery-ui": ">= 1.11.0"
|
||||
"lodash": ">= 4.14.2",
|
||||
"jquery": ">= 3.1.0",
|
||||
"jquery-ui": ">= 1.12.0"
|
||||
},
|
||||
"keywords": [
|
||||
"gridstack",
|
||||
|
|
|
@ -10,16 +10,17 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>AniJS demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
<link rel="stylesheet" href="//anijs.github.io/lib/anicollection/anicollection.css" />
|
||||
<link rel="stylesheet" href="https://anijs.github.io/lib/anicollection/anicollection.css" />
|
||||
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
@ -51,7 +52,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/AniJS/0.9.3/anijs.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/AniJS/0.9.3/anijs.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('.grid-stack').gridstack();
|
||||
|
|
|
@ -10,14 +10,15 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Float grid demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<body>
|
||||
<ul>
|
||||
<li><a href="float.html">Float grid demo</a></li>
|
||||
<li><a href="knockout.js">Knockout.js demo</a></li>
|
||||
<li><a href="knockout2.js">Knockout.js demo (2)</a></li>
|
||||
<li><a href="knockout.html">Knockout.js demo</a></li>
|
||||
<li><a href="knockout2.html">Knockout.js demo (2)</a></li>
|
||||
<li><a href="nested.html">Nested grids demo</a></li>
|
||||
<li><a href="rtl.html">RTL demo</a></li>
|
||||
<li><a href="serialization.html">Serialization demo</a></li>
|
||||
|
|
|
@ -10,15 +10,16 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Knockout.js demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
|
|
@ -10,15 +10,16 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Knockout.js demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
|
|
@ -10,14 +10,15 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Nested grids demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
|
|
@ -10,15 +10,16 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Responsive grid demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
<link rel="stylesheet" href="../dist/gridstack-extra.css"/>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
@ -117,6 +118,5 @@
|
|||
};
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -10,15 +10,16 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>RTL demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.2.0/knockout-min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
|
|
@ -10,14 +10,15 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Serialization demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
|
|
@ -10,15 +10,16 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Two grids demo</title>
|
||||
|
||||
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="../dist/gridstack.css"/>
|
||||
<link rel="stylesheet" href="../dist/gridstack-extra.css"/>
|
||||
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.0/jquery-ui.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="../dist/gridstack.js"></script>
|
||||
<script src="../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
#grid1 {
|
||||
|
|
41
dist/gridstack.all.js
vendored
Normal file
41
dist/gridstack.all.js
vendored
Normal file
File diff suppressed because one or more lines are too long
31
dist/gridstack.css
vendored
31
dist/gridstack.css
vendored
|
@ -72,7 +72,7 @@
|
|||
|
||||
.grid-stack > .grid-stack-item > .ui-resizable-se,
|
||||
.grid-stack > .grid-stack-item > .ui-resizable-sw {
|
||||
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
||||
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
-webkit-transform: rotate(45deg);
|
||||
|
@ -369,18 +369,19 @@
|
|||
transition: left 0s, top 0s, height 0s, width 0s;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.grid-stack-item {
|
||||
position: relative !important;
|
||||
width: auto !important;
|
||||
left: 0 !important;
|
||||
top: auto !important;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.grid-stack-item .ui-resizable-handle {
|
||||
display: none;
|
||||
}
|
||||
.grid-stack {
|
||||
height: auto !important;
|
||||
}
|
||||
.grid-stack.grid-stack-one-column-mode {
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
.grid-stack.grid-stack-one-column-mode > .grid-stack-item {
|
||||
position: relative !important;
|
||||
width: auto !important;
|
||||
left: 0 !important;
|
||||
top: auto !important;
|
||||
margin-bottom: 20px;
|
||||
max-width: none !important;
|
||||
}
|
||||
|
||||
.grid-stack.grid-stack-one-column-mode > .grid-stack-item > .ui-resizable-handle {
|
||||
display: none;
|
||||
}
|
||||
|
|
97
dist/gridstack.jQueryUI.js
vendored
Normal file
97
dist/gridstack.jQueryUI.js
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* gridstack.js 0.3.0-dev
|
||||
* http://troolee.github.io/gridstack.js/
|
||||
* (c) 2014-2016 Pavel Reznikov, Dylan Weiss
|
||||
* gridstack.js may be freely distributed under the MIT license.
|
||||
* @preserve
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery', 'lodash', 'gridstack', 'jquery-ui/data', 'jquery-ui/disable-selection', 'jquery-ui/focusable',
|
||||
'jquery-ui/form', 'jquery-ui/ie', 'jquery-ui/keycode', 'jquery-ui/labels', 'jquery-ui/jquery-1-7',
|
||||
'jquery-ui/plugin', 'jquery-ui/safe-active-element', 'jquery-ui/safe-blur', 'jquery-ui/scroll-parent',
|
||||
'jquery-ui/tabbable', 'jquery-ui/unique-id', 'jquery-ui/version', 'jquery-ui/widget',
|
||||
'jquery-ui/widgets/mouse', 'jquery-ui/widgets/draggable', 'jquery-ui/widgets/droppable',
|
||||
'jquery-ui/widgets/resizable'], factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
try { jQuery = require('jquery'); } catch (e) {}
|
||||
try { _ = require('lodash'); } catch (e) {}
|
||||
try { GridStackUI = require('gridstack'); } catch (e) {}
|
||||
factory(jQuery, _, GridStackUI);
|
||||
} else {
|
||||
factory(jQuery, _, GridStackUI);
|
||||
}
|
||||
})(function($, _, GridStackUI) {
|
||||
|
||||
var scope = window;
|
||||
|
||||
/**
|
||||
* @class JQueryUIGridStackDragDropPlugin
|
||||
* jQuery UI implementation of drag'n'drop gridstack plugin.
|
||||
*/
|
||||
function JQueryUIGridStackDragDropPlugin(grid) {
|
||||
GridStackUI.GridStackDragDropPlugin.call(this, grid);
|
||||
}
|
||||
|
||||
GridStackUI.GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin);
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackUI.GridStackDragDropPlugin.prototype);
|
||||
JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin;
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) {
|
||||
el = $(el);
|
||||
if (opts === 'disable' || opts === 'enable') {
|
||||
el.resizable(opts);
|
||||
} else if (opts === 'option') {
|
||||
var key = arguments[2];
|
||||
var value = arguments[3];
|
||||
el.resizable(opts, key, value);
|
||||
} else {
|
||||
el.resizable(_.extend({}, this.grid.opts.resizable, {
|
||||
start: opts.start || function() {},
|
||||
stop: opts.stop || function() {},
|
||||
resize: opts.resize || function() {}
|
||||
}));
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) {
|
||||
el = $(el);
|
||||
if (opts === 'disable' || opts === 'enable') {
|
||||
el.draggable(opts);
|
||||
} else {
|
||||
el.draggable(_.extend({}, this.grid.opts.draggable, {
|
||||
containment: this.grid.opts.isNested ? this.grid.container.parent() : null,
|
||||
start: opts.start || function() {},
|
||||
stop: opts.stop || function() {},
|
||||
drag: opts.drag || function() {}
|
||||
}));
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.droppable = function(el, opts) {
|
||||
el = $(el);
|
||||
if (opts === 'disable' || opts === 'enable') {
|
||||
el.droppable(opts);
|
||||
} else {
|
||||
el.droppable({
|
||||
accept: opts.accept
|
||||
});
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.isDroppable = function(el, opts) {
|
||||
el = $(el);
|
||||
return Boolean(el.data('droppable'));
|
||||
};
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.on = function(el, eventName, callback) {
|
||||
$(el).on(eventName, callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
return JQueryUIGridStackDragDropPlugin;
|
||||
});
|
13
dist/gridstack.jQueryUI.min.js
vendored
Normal file
13
dist/gridstack.jQueryUI.min.js
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* gridstack.js 0.3.0-dev
|
||||
* http://troolee.github.io/gridstack.js/
|
||||
* (c) 2014-2016 Pavel Reznikov, Dylan Weiss
|
||||
* gridstack.js may be freely distributed under the MIT license.
|
||||
* @preserve
|
||||
*/
|
||||
!function(a){if("function"==typeof define&&define.amd)define(["jquery","lodash","gridstack","jquery-ui/data","jquery-ui/disable-selection","jquery-ui/focusable","jquery-ui/form","jquery-ui/ie","jquery-ui/keycode","jquery-ui/labels","jquery-ui/jquery-1-7","jquery-ui/plugin","jquery-ui/safe-active-element","jquery-ui/safe-blur","jquery-ui/scroll-parent","jquery-ui/tabbable","jquery-ui/unique-id","jquery-ui/version","jquery-ui/widget","jquery-ui/widgets/mouse","jquery-ui/widgets/draggable","jquery-ui/widgets/droppable","jquery-ui/widgets/resizable"],a);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(a){}try{_=require("lodash")}catch(a){}try{GridStackUI=require("gridstack")}catch(a){}a(jQuery,_,GridStackUI)}else a(jQuery,_,GridStackUI)}(function(a,b,c){/**
|
||||
* @class JQueryUIGridStackDragDropPlugin
|
||||
* jQuery UI implementation of drag'n'drop gridstack plugin.
|
||||
*/
|
||||
function d(a){c.GridStackDragDropPlugin.call(this,a)}window;return c.GridStackDragDropPlugin.registerPlugin(d),d.prototype=Object.create(c.GridStackDragDropPlugin.prototype),d.prototype.constructor=d,d.prototype.resizable=function(c,d){if(c=a(c),"disable"===d||"enable"===d)c.resizable(d);else if("option"===d){var e=arguments[2],f=arguments[3];c.resizable(d,e,f)}else c.resizable(b.extend({},this.grid.opts.resizable,{start:d.start||function(){},stop:d.stop||function(){},resize:d.resize||function(){}}));return this},d.prototype.draggable=function(c,d){return c=a(c),"disable"===d||"enable"===d?c.draggable(d):c.draggable(b.extend({},this.grid.opts.draggable,{containment:this.grid.opts.isNested?this.grid.container.parent():null,start:d.start||function(){},stop:d.stop||function(){},drag:d.drag||function(){}})),this},d.prototype.droppable=function(b,c){return b=a(b),"disable"===c||"enable"===c?b.droppable(c):b.droppable({accept:c.accept}),this},d.prototype.isDroppable=function(b,c){return b=a(b),Boolean(b.data("droppable"))},d.prototype.on=function(b,c,d){return a(b).on(c,d),this},d});
|
||||
//# sourceMappingURL=gridstack.min.map
|
224
dist/gridstack.js
vendored
224
dist/gridstack.js
vendored
|
@ -1,14 +1,13 @@
|
|||
/**
|
||||
* gridstack.js 0.2.5
|
||||
* gridstack.js 0.3.0-dev
|
||||
* http://troolee.github.io/gridstack.js/
|
||||
* (c) 2014-2016 Pavel Reznikov
|
||||
* (c) 2014-2016 Pavel Reznikov, Dylan Weiss
|
||||
* gridstack.js may be freely distributed under the MIT license.
|
||||
* @preserve
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery', 'lodash', 'jquery-ui/core', 'jquery-ui/widget', 'jquery-ui/mouse', 'jquery-ui/draggable',
|
||||
'jquery-ui/resizable'], factory);
|
||||
define(['jquery', 'lodash'], factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
try { jQuery = require('jquery'); } catch (e) {}
|
||||
try { _ = require('lodash'); } catch (e) {}
|
||||
|
@ -120,6 +119,41 @@
|
|||
Utils.insert_css_rule = obsolete(Utils.insertCSSRule, 'insert_css_rule', 'insertCSSRule');
|
||||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
|
||||
/**
|
||||
* @class GridStackDragDropPlugin
|
||||
* Base class for drag'n'drop plugin.
|
||||
*/
|
||||
function GridStackDragDropPlugin(grid) {
|
||||
this.grid = grid;
|
||||
}
|
||||
|
||||
GridStackDragDropPlugin.registeredPlugins = [];
|
||||
|
||||
GridStackDragDropPlugin.registerPlugin = function(pluginClass) {
|
||||
GridStackDragDropPlugin.registeredPlugins.push(pluginClass);
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.resizable = function(el, opts) {
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.draggable = function(el, opts) {
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.droppable = function(el, opts) {
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.isDroppable = function(el) {
|
||||
return false;
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.on = function(el, eventName, callback) {
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
var idSeq = 0;
|
||||
|
||||
var GridStackEngine = function(width, onchange, floatMode, height, items) {
|
||||
|
@ -277,12 +311,14 @@
|
|||
};
|
||||
|
||||
GridStackEngine.prototype._notify = function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
args[0] = typeof args[0] === 'undefined' ? [] : [args[0]];
|
||||
args[1] = typeof args[1] === 'undefined' ? true : args[1];
|
||||
if (this._updateCounter) {
|
||||
return;
|
||||
}
|
||||
var deletedNodes = Array.prototype.slice.call(arguments, 0);
|
||||
deletedNodes = deletedNodes.concat(this.getDirtyNodes());
|
||||
this.onchange(deletedNodes);
|
||||
var deletedNodes = args[0].concat(this.getDirtyNodes());
|
||||
this.onchange(deletedNodes, args[1]);
|
||||
};
|
||||
|
||||
GridStackEngine.prototype.cleanNodes = function() {
|
||||
|
@ -341,12 +377,13 @@
|
|||
node._id = null;
|
||||
this.nodes = _.without(this.nodes, node);
|
||||
this._packNodes();
|
||||
if (detachNode) {
|
||||
this._notify(node);
|
||||
}
|
||||
this._notify(node, detachNode);
|
||||
};
|
||||
|
||||
GridStackEngine.prototype.canMoveNode = function(node, x, y, width, height) {
|
||||
if (!this.isNodeChangedPosition(node, x, y, width, height)) {
|
||||
return false;
|
||||
}
|
||||
var hasLocked = Boolean(_.find(this.nodes, function(n) { return n.locked; }));
|
||||
|
||||
if (!this.height && !hasLocked) {
|
||||
|
@ -402,7 +439,27 @@
|
|||
return clone.getGridHeight() <= this.height;
|
||||
};
|
||||
|
||||
GridStackEngine.prototype.isNodeChangedPosition = function(node, x, y, width, height) {
|
||||
if (typeof x != 'number') { x = node.x; }
|
||||
if (typeof y != 'number') { y = node.y; }
|
||||
if (typeof width != 'number') { width = node.width; }
|
||||
if (typeof height != 'number') { height = node.height; }
|
||||
|
||||
if (typeof node.maxWidth != 'undefined') { width = Math.min(width, node.maxWidth); }
|
||||
if (typeof node.maxHeight != 'undefined') { height = Math.min(height, node.maxHeight); }
|
||||
if (typeof node.minWidth != 'undefined') { width = Math.max(width, node.minWidth); }
|
||||
if (typeof node.minHeight != 'undefined') { height = Math.max(height, node.minHeight); }
|
||||
|
||||
if (node.x == x && node.y == y && node.width == width && node.height == height) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
GridStackEngine.prototype.moveNode = function(node, x, y, width, height, noPack) {
|
||||
if (!this.isNodeChangedPosition(node, x, y, width, height)) {
|
||||
return node;
|
||||
}
|
||||
if (typeof x != 'number') { x = node.x; }
|
||||
if (typeof y != 'number') { y = node.y; }
|
||||
if (typeof width != 'number') { width = node.width; }
|
||||
|
@ -425,6 +482,11 @@
|
|||
node.width = width;
|
||||
node.height = height;
|
||||
|
||||
node.lastTriedX = x;
|
||||
node.lastTriedY = y;
|
||||
node.lastTriedWidth = width;
|
||||
node.lastTriedHeight = height;
|
||||
|
||||
node = this._prepareNode(node, resizing);
|
||||
|
||||
this._fixCollisions(node);
|
||||
|
@ -508,7 +570,7 @@
|
|||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
|
||||
opts.itemClass = opts.itemClass || 'grid-stack-item';
|
||||
var isNested = this.container.closest('.' + opts.itemClass).size() > 0;
|
||||
var isNested = this.container.closest('.' + opts.itemClass).length > 0;
|
||||
|
||||
this.opts = _.defaults(opts || {}, {
|
||||
width: parseInt(this.container.attr('data-gs-width')) || 12,
|
||||
|
@ -543,9 +605,19 @@
|
|||
removable: false,
|
||||
removeTimeout: 2000,
|
||||
verticalMarginUnit: 'px',
|
||||
cellHeightUnit: 'px'
|
||||
cellHeightUnit: 'px',
|
||||
oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode',
|
||||
ddPlugin: null
|
||||
});
|
||||
|
||||
if (this.opts.ddPlugin === false) {
|
||||
this.opts.ddPlugin = GridStackDragDropPlugin;
|
||||
} else if (this.opts.ddPlugin === null) {
|
||||
this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins) || GridStackDragDropPlugin;
|
||||
}
|
||||
|
||||
this.dd = new this.opts.ddPlugin(this);
|
||||
|
||||
if (this.opts.rtl === 'auto') {
|
||||
this.opts.rtl = this.container.css('direction') === 'rtl';
|
||||
}
|
||||
|
@ -574,10 +646,11 @@
|
|||
|
||||
this._initStyles();
|
||||
|
||||
this.grid = new GridStackEngine(this.opts.width, function(nodes) {
|
||||
this.grid = new GridStackEngine(this.opts.width, function(nodes, detachNode) {
|
||||
detachNode = typeof detachNode === 'undefined' ? true : detachNode;
|
||||
var maxHeight = 0;
|
||||
_.each(nodes, function(n) {
|
||||
if (n._id === null) {
|
||||
if (detachNode && n._id === null) {
|
||||
if (n.el) {
|
||||
n.el.remove();
|
||||
}
|
||||
|
@ -630,7 +703,7 @@
|
|||
if (oneColumnMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.container.addClass(self.opts.oneColumnModeClass);
|
||||
oneColumnMode = true;
|
||||
|
||||
self.grid._sortNodes();
|
||||
|
@ -641,17 +714,20 @@
|
|||
return;
|
||||
}
|
||||
if (node.noMove || self.opts.disableDrag) {
|
||||
node.el.draggable('disable');
|
||||
self.dd.draggable(node.el, 'disable');
|
||||
}
|
||||
if (node.noResize || self.opts.disableResize) {
|
||||
node.el.resizable('disable');
|
||||
self.dd.resizable(node.el, 'disable');
|
||||
}
|
||||
|
||||
node.el.trigger('resize');
|
||||
});
|
||||
} else {
|
||||
if (!oneColumnMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.container.removeClass(self.opts.oneColumnModeClass);
|
||||
oneColumnMode = false;
|
||||
|
||||
if (self.opts.staticGrid) {
|
||||
|
@ -660,11 +736,13 @@
|
|||
|
||||
_.each(self.grid.nodes, function(node) {
|
||||
if (!node.noMove && !self.opts.disableDrag) {
|
||||
node.el.draggable('enable');
|
||||
self.dd.draggable(node.el, 'enable');
|
||||
}
|
||||
if (!node.noResize && !self.opts.disableResize) {
|
||||
node.el.resizable('enable');
|
||||
self.dd.resizable(node.el, 'enable');
|
||||
}
|
||||
|
||||
node.el.trigger('resize');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -672,15 +750,15 @@
|
|||
$(window).resize(this.onResizeHandler);
|
||||
this.onResizeHandler();
|
||||
|
||||
if (typeof self.opts.removable === 'string') {
|
||||
if (!self.opts.staticGrid && typeof self.opts.removable === 'string') {
|
||||
var trashZone = $(self.opts.removable);
|
||||
if (!trashZone.data('droppable')) {
|
||||
trashZone.droppable({
|
||||
if (!this.dd.isDroppable(trashZone)) {
|
||||
this.dd.droppable(trashZone, {
|
||||
accept: '.' + self.opts.itemClass
|
||||
});
|
||||
}
|
||||
trashZone
|
||||
.on('dropover', function(event, ui) {
|
||||
this.dd
|
||||
.on(trashZone, 'dropover', function(event, ui) {
|
||||
var el = $(ui.draggable);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (node._grid !== self) {
|
||||
|
@ -688,7 +766,7 @@
|
|||
}
|
||||
self._setupRemovingTimeout(el);
|
||||
})
|
||||
.on('dropout', function(event, ui) {
|
||||
.on(trashZone, 'dropout', function(event, ui) {
|
||||
var el = $(ui.draggable);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (node._grid !== self) {
|
||||
|
@ -698,7 +776,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
if (self.opts.acceptWidgets) {
|
||||
if (!self.opts.staticGrid && self.opts.acceptWidgets) {
|
||||
var draggingElement = null;
|
||||
|
||||
var onDrag = function(event, ui) {
|
||||
|
@ -738,16 +816,18 @@
|
|||
}
|
||||
};
|
||||
|
||||
$(self.container).droppable({
|
||||
accept: function(el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (node && node._grid === self) {
|
||||
return false;
|
||||
this.dd
|
||||
.droppable(self.container, {
|
||||
accept: function(el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (node && node._grid === self) {
|
||||
return false;
|
||||
}
|
||||
return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets);
|
||||
}
|
||||
return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets);
|
||||
},
|
||||
over: function(event, ui) {
|
||||
})
|
||||
.on(self.container, 'dropover', function(event, ui) {
|
||||
var offset = self.container.offset();
|
||||
var el = $(ui.draggable);
|
||||
var cellWidth = self.cellWidth();
|
||||
|
@ -764,8 +844,8 @@
|
|||
el.data('_gridstack_node_orig', origNode);
|
||||
|
||||
el.on('drag', onDrag);
|
||||
},
|
||||
out: function(event, ui) {
|
||||
})
|
||||
.on(self.container, 'dropout', function(event, ui) {
|
||||
var el = $(ui.draggable);
|
||||
el.unbind('drag', onDrag);
|
||||
var node = el.data('_gridstack_node');
|
||||
|
@ -774,8 +854,8 @@
|
|||
self.placeholder.detach();
|
||||
self._updateContainerHeight();
|
||||
el.data('_gridstack_node', el.data('_gridstack_node_orig'));
|
||||
},
|
||||
drop: function(event, ui) {
|
||||
})
|
||||
.on(self.container, 'drop', function(event, ui) {
|
||||
self.placeholder.detach();
|
||||
|
||||
var node = $(ui.draggable).data('_gridstack_node');
|
||||
|
@ -797,13 +877,12 @@
|
|||
.removeClass('ui-draggable ui-draggable-dragging ui-draggable-disabled')
|
||||
.unbind('drag', onDrag);
|
||||
self.container.append(el);
|
||||
self._prepareElementByNode(el, node);
|
||||
self._prepareElementsByNode(el, node);
|
||||
self._updateContainerHeight();
|
||||
self._triggerChangeEvent();
|
||||
|
||||
self.grid.endUpdate();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -965,7 +1044,10 @@
|
|||
node._isAboutToRemove = false;
|
||||
};
|
||||
|
||||
GridStack.prototype._prepareElementByNode = function(el, node) {
|
||||
GridStack.prototype._prepareElementsByNode = function(el, node) {
|
||||
if (typeof $.ui === 'undefined') {
|
||||
return;
|
||||
}
|
||||
var self = this;
|
||||
|
||||
var cellWidth;
|
||||
|
@ -1018,10 +1100,18 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!self.grid.canMoveNode(node, x, y, width, height)) {
|
||||
// width and height are undefined if not resizing
|
||||
var lastTriedWidth = typeof width !== 'undefined' ? width : node.lastTriedWidth;
|
||||
var lastTriedHeight = typeof height !== 'undefined' ? height : node.lastTriedHeight;
|
||||
if (!self.grid.canMoveNode(node, x, y, width, height) ||
|
||||
(node.lastTriedX === x && node.lastTriedY === y &&
|
||||
node.lastTriedWidth === lastTriedWidth && node.lastTriedHeight === lastTriedHeight)) {
|
||||
return;
|
||||
}
|
||||
node.lastTriedX = x;
|
||||
node.lastTriedY = y;
|
||||
node.lastTriedWidth = width;
|
||||
node.lastTriedHeight = height;
|
||||
self.grid.moveNode(node, x, y, width, height);
|
||||
self._updateContainerHeight();
|
||||
};
|
||||
|
@ -1031,7 +1121,7 @@
|
|||
var o = $(this);
|
||||
self.grid.cleanNodes();
|
||||
self.grid.beginUpdate(node);
|
||||
cellWidth = Math.ceil(o.outerWidth() / o.attr('data-gs-width'));
|
||||
cellWidth = self.cellWidth();
|
||||
var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
||||
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
|
||||
self.placeholder
|
||||
|
@ -1044,8 +1134,8 @@
|
|||
node._beforeDragX = node.x;
|
||||
node._beforeDragY = node.y;
|
||||
|
||||
el.resizable('option', 'minWidth', cellWidth * (node.minWidth || 1));
|
||||
el.resizable('option', 'minHeight', strictCellHeight * (node.minHeight || 1));
|
||||
self.dd.resizable(el, 'option', 'minWidth', cellWidth * (node.minWidth || 1));
|
||||
self.dd.resizable(el, 'option', 'minHeight', strictCellHeight * (node.minHeight || 1));
|
||||
|
||||
if (event.type == 'resizestart') {
|
||||
o.find('.grid-stack-item').trigger('resizestart');
|
||||
|
@ -1102,25 +1192,24 @@
|
|||
}
|
||||
};
|
||||
|
||||
el
|
||||
.draggable(_.extend(this.opts.draggable, {
|
||||
containment: this.opts.isNested ? this.container.parent() : null,
|
||||
this.dd
|
||||
.draggable(el, {
|
||||
start: onStartMoving,
|
||||
stop: onEndMoving,
|
||||
drag: dragOrResize
|
||||
}))
|
||||
.resizable(_.extend(this.opts.resizable, {
|
||||
})
|
||||
.resizable(el, {
|
||||
start: onStartMoving,
|
||||
stop: onEndMoving,
|
||||
resize: dragOrResize
|
||||
}));
|
||||
});
|
||||
|
||||
if (node.noMove || this._isOneColumnMode() || this.opts.staticGrid || this.opts.disableDrag) {
|
||||
el.draggable('disable');
|
||||
if (node.noMove || this._isOneColumnMode() || this.opts.disableDrag) {
|
||||
this.dd.draggable(el, 'disable');
|
||||
}
|
||||
|
||||
if (node.noResize || this._isOneColumnMode() || this.opts.staticGrid || this.opts.disableResize) {
|
||||
el.resizable('disable');
|
||||
if (node.noResize || this._isOneColumnMode() || this.opts.disableResize) {
|
||||
this.dd.resizable(el, 'disable');
|
||||
}
|
||||
|
||||
el.attr('data-gs-locked', node.locked ? 'yes' : null);
|
||||
|
@ -1151,7 +1240,7 @@
|
|||
}, triggerAddEvent);
|
||||
el.data('_gridstack_node', node);
|
||||
|
||||
this._prepareElementByNode(el, node);
|
||||
this._prepareElementsByNode(el, node);
|
||||
};
|
||||
|
||||
GridStack.prototype.setAnimation = function(enable) {
|
||||
|
@ -1232,6 +1321,7 @@
|
|||
this.disable();
|
||||
if (typeof detachGrid != 'undefined' && !detachGrid) {
|
||||
this.removeAll(false);
|
||||
this.container.removeData('gridstack');
|
||||
} else {
|
||||
this.container.remove();
|
||||
}
|
||||
|
@ -1247,15 +1337,15 @@
|
|||
el.each(function(index, el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (typeof node == 'undefined' || node === null) {
|
||||
if (typeof node == 'undefined' || node === null || typeof $.ui === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
node.noResize = !(val || false);
|
||||
if (node.noResize || self._isOneColumnMode()) {
|
||||
el.resizable('disable');
|
||||
self.dd.resizable(el, 'disable');
|
||||
} else {
|
||||
el.resizable('enable');
|
||||
self.dd.resizable(el, 'enable');
|
||||
}
|
||||
});
|
||||
return this;
|
||||
|
@ -1267,16 +1357,16 @@
|
|||
el.each(function(index, el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (typeof node == 'undefined' || node === null) {
|
||||
if (typeof node == 'undefined' || node === null || typeof $.ui === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
node.noMove = !(val || false);
|
||||
if (node.noMove || self._isOneColumnMode()) {
|
||||
el.draggable('disable');
|
||||
self.dd.draggable(el, 'disable');
|
||||
el.removeClass('ui-draggable-handle');
|
||||
} else {
|
||||
el.draggable('enable');
|
||||
self.dd.draggable(el, 'enable');
|
||||
el.addClass('ui-draggable-handle');
|
||||
}
|
||||
});
|
||||
|
@ -1482,8 +1572,7 @@
|
|||
};
|
||||
|
||||
GridStack.prototype.cellWidth = function() {
|
||||
var o = this.container.children('.' + this.opts.itemClass).first();
|
||||
return Math.ceil(o.outerWidth() / parseInt(o.attr('data-gs-width'), 10));
|
||||
return Math.round(this.container.outerWidth() / this.opts.width);
|
||||
};
|
||||
|
||||
GridStack.prototype.getCellFromPixel = function(position, useOffset) {
|
||||
|
@ -1633,6 +1722,7 @@
|
|||
|
||||
scope.GridStackUI.Utils = Utils;
|
||||
scope.GridStackUI.Engine = GridStackEngine;
|
||||
scope.GridStackUI.GridStackDragDropPlugin = GridStackDragDropPlugin;
|
||||
|
||||
$.fn.gridstack = function(opts) {
|
||||
return this.each(function() {
|
||||
|
|
2
dist/gridstack.min.css
vendored
2
dist/gridstack.min.css
vendored
File diff suppressed because one or more lines are too long
28
dist/gridstack.min.js
vendored
28
dist/gridstack.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/gridstack.min.map
vendored
2
dist/gridstack.min.map
vendored
File diff suppressed because one or more lines are too long
51
doc/FAQ.md
Normal file
51
doc/FAQ.md
Normal file
|
@ -0,0 +1,51 @@
|
|||
Frequently asked questions
|
||||
==========================
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
|
||||
|
||||
- [Gridstack doesn't use bootstrap 3 classes. Why you say it's bootstrap 3 friendly.](#gridstack-doesnt-use-bootstrap-3-classes-why-you-say-its-bootstrap-3-friendly)
|
||||
- [How can I create a static layout using gridstack.](#how-can-i-create-a-static-layout-using-gridstack)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
### Gridstack doesn't use bootstrap 3 classes. Why you say it's bootstrap 3 friendly.
|
||||
|
||||
**Q:**
|
||||
|
||||
Original issue #390:
|
||||
|
||||
> Hi,
|
||||
>
|
||||
> Excuse my ignorance but on your site you write "responsive bootstrap v3 friendly layouts" but how?
|
||||
>
|
||||
> In none of the examples you actually make use of any bootstrap classes. You add it to head but if you do that with gridster it works exactly the same..
|
||||
>
|
||||
> What does gridstack do different then gridster?
|
||||
>
|
||||
> Reason I'm asking is because I have bootstrap HTML templates I want to put them in the grid so users can move it all around .. then when done have a normal html page (without the draggable grid). I thought gridstack would help to do that in favor of gridster but so far I have not seen any difference between the 2..
|
||||
>
|
||||
> Thanks!
|
||||
|
||||
**A:**
|
||||
|
||||
We never declare that gridstack uses bootstrap classes. We say that gridstack could be responsive (widgets are not fixed width) it works well on bootstrap 3 pages with fixed or responsive layout. That's why it says bootstrap 3 friendly.
|
||||
|
||||
It wasn't a goal for gridstack to create bootstrap 3 layouts. It's not a goal now neither. The goal of gridstack is to create dashboard layouts with draggable/resizable widgets.
|
||||
|
||||
Gridstack uses internal grid to implement its logic. DOM nodes are just interpretation of this grid. So we or you probably could create a third party library which exports this internal grid into bootstrap 3/bootstrap 4/absolute divs/whatever layout. But I don't see this as part of gridstack core. As the same as support of angular/knockout/whatever libraries. We're doing all necessary for smooth support but it will never be a part of core.
|
||||
|
||||
The main idea is to build as simple and flexible lib as possible.
|
||||
|
||||
|
||||
### How can I create a static layout using gridstack.
|
||||
|
||||
**Q:**
|
||||
|
||||
How can I create a static layout not using jQuery UI, etc.
|
||||
|
||||
**A:**
|
||||
|
||||
The main propose of gridstack is creating dashboards with draggable and/or resizable widgets. You could disable this behavior by setting `static` option. At this point you will probably
|
||||
still need to include jQuery UI. But we will try to decrease dependency of it in near future.
|
|
@ -68,15 +68,17 @@ gridstack.js API
|
|||
- a string (ex: '10em', '100px', '10rem')
|
||||
- 0 or null, in which case the library will not generate styles for rows. Everything must be defined in CSS files.
|
||||
- `'auto'` - height will be calculated from cell width.
|
||||
- `ddPlugin` - class that implement drag'n'drop functionallity for gridstack. If `false` grid will be static. (default: `null` - first available plugin will be used)
|
||||
- `disableDrag` - disallows dragging of widgets (default: `false`).
|
||||
- `disableResize` - disallows resizing of widgets (default: `false`).
|
||||
- `draggable` - allows to override jQuery UI draggable options. (default: `{handle: '.grid-stack-item-content', scroll: true, appendTo: 'body'}`)
|
||||
- `draggable` - allows to override jQuery UI draggable options. (default: `{handle: '.grid-stack-item-content', scroll: false, appendTo: 'body'}`)
|
||||
- `handle` - draggable handle selector (default: `'.grid-stack-item-content'`)
|
||||
- `handleClass` - draggable handle class (e.g. `'grid-stack-item-content'`). If set `handle` is ignored (default: `null`)
|
||||
- `height` - maximum rows amount. Default is `0` which means no maximum rows
|
||||
- `float` - enable floating widgets (default: `false`) See [example](http://troolee.github.io/gridstack.js/demo/float.html)
|
||||
- `itemClass` - widget class (default: `'grid-stack-item'`)
|
||||
- `minWidth` - minimal width. If window width is less, grid will be shown in one-column mode. You need also update your css file (`@media (max-width: 768px) {...}`) with corresponding value (default: `768`)
|
||||
- `minWidth` - minimal width. If window width is less, grid will be shown in one-column mode (default: `768`)
|
||||
- `oneColumnModeClass` - class set on grid when in one column mode (default: 'grid-stack-one-column-mode')
|
||||
- `placeholderClass` - class for placeholder (default: `'grid-stack-placeholder'`)
|
||||
- `placeholderText` - placeholder default content (default: `''`)
|
||||
- `resizable` - allows to override jQuery UI resizable options. (default: `{autoHide: true, handles: 'se'}`)
|
||||
|
|
|
@ -19,6 +19,7 @@ module.exports = function(config) {
|
|||
'bower_components/jquery-ui/jquery-ui.min.js',
|
||||
'bower_components/lodash/dist/lodash.min.js',
|
||||
'src/gridstack.js',
|
||||
'src/gridstack.jQueryUI.js',
|
||||
'spec/*-spec.js'
|
||||
],
|
||||
|
||||
|
@ -31,7 +32,8 @@ module.exports = function(config) {
|
|||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
'src/gridstack.js': ['coverage']
|
||||
'src/gridstack.js': ['coverage'],
|
||||
'src/gridstack.jQueryUI.js': ['coverage'],
|
||||
},
|
||||
|
||||
|
||||
|
|
24
package.json
24
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "gridstack",
|
||||
"version": "0.2.5",
|
||||
"version": "0.3.0-dev",
|
||||
"description": "gridstack.js is a jQuery plugin for widget layout",
|
||||
"main": "dist/gridstack.js",
|
||||
"repository": {
|
||||
|
@ -25,14 +25,16 @@
|
|||
},
|
||||
"homepage": "http://troolee.github.io/gridstack.js/",
|
||||
"dependencies": {
|
||||
"jquery": "^2.2.1",
|
||||
"jquery-ui": "^1.10.5",
|
||||
"lodash": "^4.5.1"
|
||||
"jquery": "^3.1.0",
|
||||
"jquery-ui": "^1.12.0",
|
||||
"lodash": "^4.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"connect": "^3.4.1",
|
||||
"coveralls": "^2.11.6",
|
||||
"coveralls": "^2.11.8",
|
||||
"doctoc": "^1.0.0",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-contrib-connect": "^0.11.2",
|
||||
"grunt-contrib-copy": "^0.8.2",
|
||||
"grunt-contrib-cssmin": "^0.14.0",
|
||||
|
@ -40,17 +42,17 @@
|
|||
"grunt-contrib-uglify": "^0.11.1",
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-doctoc": "^0.1.1",
|
||||
"grunt-jscs": "^2.7.0",
|
||||
"grunt-protractor-runner": "^3.0.0",
|
||||
"grunt-jscs": "^2.8.0",
|
||||
"grunt-protractor-runner": "^3.2.0",
|
||||
"grunt-protractor-webdriver": "^0.2.5",
|
||||
"grunt-sass": "^1.1.0",
|
||||
"jasmine-core": "^2.4.1",
|
||||
"karma": "^0.13.21",
|
||||
"karma-coverage": "^0.5.3",
|
||||
"karma": "^1.1.2",
|
||||
"karma-coverage": "^1.1.1",
|
||||
"karma-coveralls": "^1.1.2",
|
||||
"karma-jasmine": "^0.3.7",
|
||||
"karma-jasmine": "^1.0.2",
|
||||
"karma-phantomjs-launcher": "^1.0.0",
|
||||
"phantomjs-prebuilt": "^2.1.4",
|
||||
"phantomjs-prebuilt": "^2.1.5",
|
||||
"serve-static": "^1.10.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
||||
<script src="../../../dist/gridstack.js"></script>
|
||||
<script src="../../../dist/gridstack.jQueryUI.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.grid-stack {
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('gridstack engine', function() {
|
|||
|
||||
beforeAll(function() {
|
||||
engine = new GridStackUI.Engine(12);
|
||||
})
|
||||
});
|
||||
|
||||
it('should be setup properly', function() {
|
||||
expect(engine.width).toEqual(12);
|
||||
|
@ -29,7 +29,7 @@ describe('gridstack engine', function() {
|
|||
|
||||
beforeAll(function() {
|
||||
engine = new GridStackUI.Engine(12);
|
||||
})
|
||||
});
|
||||
|
||||
it('should prepare a node', function() {
|
||||
expect(engine._prepareNode({}, false)).toEqual(jasmine.objectContaining({x: 0, y: 0, width: 1, height: 1}));
|
||||
|
@ -57,7 +57,7 @@ describe('gridstack engine', function() {
|
|||
engine.nodes = [
|
||||
engine._prepareNode({x: 3, y: 2, width: 3, height: 2})
|
||||
];
|
||||
})
|
||||
});
|
||||
|
||||
it('should be true', function() {
|
||||
expect(engine.isAreaEmpty(0, 0, 3, 2)).toEqual(true);
|
||||
|
@ -108,14 +108,14 @@ describe('gridstack engine', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe('test batchUpdate/commit', function () {
|
||||
describe('test batchUpdate/commit', function() {
|
||||
var engine;
|
||||
|
||||
beforeAll(function () {
|
||||
engine = new GridStackUI.Engine(12)
|
||||
beforeAll(function() {
|
||||
engine = new GridStackUI.Engine(12);
|
||||
});
|
||||
|
||||
it('should work on not float grids', function () {
|
||||
it('should work on not float grids', function() {
|
||||
expect(engine.float).toEqual(false);
|
||||
engine.batchUpdate();
|
||||
expect(engine._updateCounter).toBeGreaterThan(0);
|
||||
|
@ -126,14 +126,14 @@ describe('gridstack engine', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe('test batchUpdate/commit', function () {
|
||||
describe('test batchUpdate/commit', function() {
|
||||
var engine;
|
||||
|
||||
beforeAll(function () {
|
||||
engine = new GridStackUI.Engine(12, null, true)
|
||||
beforeAll(function() {
|
||||
engine = new GridStackUI.Engine(12, null, true);
|
||||
});
|
||||
|
||||
it('should work on float grids', function () {
|
||||
it('should work on float grids', function() {
|
||||
expect(engine.float).toEqual(true);
|
||||
engine.batchUpdate();
|
||||
expect(engine._updateCounter).toBeGreaterThan(0);
|
||||
|
@ -150,8 +150,8 @@ describe('gridstack engine', function() {
|
|||
|
||||
beforeEach(function() {
|
||||
spy = {
|
||||
callback: function () {}
|
||||
}
|
||||
callback: function() {}
|
||||
};
|
||||
spyOn(spy, 'callback');
|
||||
|
||||
engine = new GridStackUI.Engine(12, spy.callback, true);
|
||||
|
@ -176,37 +176,47 @@ describe('gridstack engine', function() {
|
|||
expect(spy.callback).toHaveBeenCalledWith([
|
||||
engine.nodes[0],
|
||||
engine.nodes[1]
|
||||
]);
|
||||
], true);
|
||||
});
|
||||
|
||||
it('should by called with extra passed dirty nodes', function() {
|
||||
var n1 = {idx: -1},
|
||||
n2 = {idx: -2};
|
||||
it('should by called with extra passed node to be removed', function() {
|
||||
var n1 = {idx: -1};
|
||||
|
||||
engine._notify(n1, n2);
|
||||
engine._notify(n1);
|
||||
|
||||
expect(spy.callback).toHaveBeenCalledWith([
|
||||
n1,
|
||||
n2,
|
||||
engine.nodes[0],
|
||||
engine.nodes[1]
|
||||
]);
|
||||
], true);
|
||||
});
|
||||
|
||||
it('should by called with extra passed node to be removed and should maintain false parameter', function() {
|
||||
var n1 = {idx: -1};
|
||||
|
||||
engine._notify(n1, false);
|
||||
|
||||
expect(spy.callback).toHaveBeenCalledWith([
|
||||
n1,
|
||||
engine.nodes[0],
|
||||
engine.nodes[1]
|
||||
], false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('test _packNodes', function () {
|
||||
describe('using not float mode', function () {
|
||||
describe('test _packNodes', function() {
|
||||
describe('using not float mode', function() {
|
||||
var engine;
|
||||
|
||||
var findNode = function (engine, id) {
|
||||
return _.find(engine.nodes, function(i) { return i._id === id });
|
||||
}
|
||||
var findNode = function(engine, id) {
|
||||
return _.find(engine.nodes, function(i) { return i._id === id; });
|
||||
};
|
||||
|
||||
beforeEach(function () {
|
||||
beforeEach(function() {
|
||||
engine = new GridStackUI.Engine(12, null, false);
|
||||
});
|
||||
|
||||
it('shouldn\'t pack one node with y coord eq 0', function () {
|
||||
it('shouldn\'t pack one node with y coord eq 0', function() {
|
||||
engine.nodes = [
|
||||
{x: 0, y: 0, width: 1, height: 1, _id: 1},
|
||||
];
|
||||
|
@ -217,7 +227,7 @@ describe('gridstack engine', function() {
|
|||
expect(findNode(engine, 1)._dirty).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should pack one node correctly', function () {
|
||||
it('should pack one node correctly', function() {
|
||||
engine.nodes = [
|
||||
{x: 0, y: 1, width: 1, height: 1, _id: 1},
|
||||
];
|
||||
|
@ -227,7 +237,7 @@ describe('gridstack engine', function() {
|
|||
expect(findNode(engine, 1)).toEqual(jasmine.objectContaining({x: 0, y: 0, width: 1, height: 1, _dirty: true}));
|
||||
});
|
||||
|
||||
it('should pack nodes correctly', function () {
|
||||
it('should pack nodes correctly', function() {
|
||||
engine.nodes = [
|
||||
{x: 0, y: 1, width: 1, height: 1, _id: 1},
|
||||
{x: 0, y: 5, width: 1, height: 1, _id: 2},
|
||||
|
@ -239,7 +249,7 @@ describe('gridstack engine', function() {
|
|||
expect(findNode(engine, 2)).toEqual(jasmine.objectContaining({x: 0, y: 1, width: 1, height: 1, _dirty: true}));
|
||||
});
|
||||
|
||||
it('should pack nodes correctly', function () {
|
||||
it('should pack nodes correctly', function() {
|
||||
engine.nodes = [
|
||||
{x: 0, y: 5, width: 1, height: 1, _id: 1},
|
||||
{x: 0, y: 1, width: 1, height: 1, _id: 2},
|
||||
|
@ -251,7 +261,7 @@ describe('gridstack engine', function() {
|
|||
expect(findNode(engine, 1)).toEqual(jasmine.objectContaining({x: 0, y: 1, width: 1, height: 1, _dirty: true}));
|
||||
});
|
||||
|
||||
it('should respect locked nodes', function () {
|
||||
it('should respect locked nodes', function() {
|
||||
engine.nodes = [
|
||||
{x: 0, y: 1, width: 1, height: 1, _id: 1, locked: true},
|
||||
{x: 0, y: 5, width: 1, height: 1, _id: 2},
|
||||
|
@ -265,4 +275,37 @@ describe('gridstack engine', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test isNodeChangedPosition', function() {
|
||||
var engine;
|
||||
|
||||
beforeAll(function() {
|
||||
engine = new GridStackUI.Engine(12);
|
||||
});
|
||||
|
||||
it('should return true for changed x', function() {
|
||||
var widget = { x: 1, y: 2, width: 3, height: 4 };
|
||||
expect(engine.isNodeChangedPosition(widget, 2, 2)).toEqual(true);
|
||||
});
|
||||
|
||||
it('should return true for changed y', function() {
|
||||
var widget = { x: 1, y: 2, width: 3, height: 4 };
|
||||
expect(engine.isNodeChangedPosition(widget, 1, 1)).toEqual(true);
|
||||
});
|
||||
|
||||
it('should return true for changed width', function() {
|
||||
var widget = { x: 1, y: 2, width: 3, height: 4 };
|
||||
expect(engine.isNodeChangedPosition(widget, 2, 2, 4, 4)).toEqual(true);
|
||||
});
|
||||
|
||||
it('should return true for changed height', function() {
|
||||
var widget = { x: 1, y: 2, width: 3, height: 4 };
|
||||
expect(engine.isNodeChangedPosition(widget, 1, 2, 3, 3)).toEqual(true);
|
||||
});
|
||||
|
||||
it('should return false for unchanged position', function() {
|
||||
var widget = { x: 1, y: 2, width: 3, height: 4 };
|
||||
expect(engine.isNodeChangedPosition(widget, 1, 2, 3, 4)).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -220,14 +220,27 @@ describe('gridstack', function() {
|
|||
afterEach(function() {
|
||||
document.body.removeChild(document.getElementsByClassName('grid-stack')[0]);
|
||||
});
|
||||
it('should return 96.', function() {
|
||||
it('should return 1/12th of container width.', function() {
|
||||
var options = {
|
||||
cellHeight: 80,
|
||||
verticalMargin: 10
|
||||
verticalMargin: 10,
|
||||
width: 12
|
||||
};
|
||||
$('.grid-stack').gridstack(options);
|
||||
var grid = $('.grid-stack').data('gridstack');
|
||||
expect(grid.cellWidth()).toBe(96);
|
||||
var res = Math.round($('.grid-stack').outerWidth() / 12);
|
||||
expect(grid.cellWidth()).toBe(res);
|
||||
});
|
||||
it('should return 1/10th of container width.', function() {
|
||||
var options = {
|
||||
cellHeight: 80,
|
||||
verticalMargin: 10,
|
||||
width: 10
|
||||
};
|
||||
$('.grid-stack').gridstack(options);
|
||||
var grid = $('.grid-stack').data('gridstack');
|
||||
var res = Math.round($('.grid-stack').outerWidth() / 10);
|
||||
expect(grid.cellWidth()).toBe(res);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -67,14 +67,14 @@ describe('gridstack utils', function() {
|
|||
|
||||
var style = $('STYLE[data-gs-style-id=' + _id + ']');
|
||||
|
||||
expect(style.size()).toEqual(1);
|
||||
expect(style.length).toEqual(1);
|
||||
expect(style.prop('tagName')).toEqual('STYLE');
|
||||
|
||||
utils.removeStylesheet(_id)
|
||||
|
||||
style = $('STYLE[data-gs-style-id=' + _id + ']');
|
||||
|
||||
expect(style.size()).toEqual(0);
|
||||
expect(style.length).toEqual(0);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
97
src/gridstack.jQueryUI.js
Normal file
97
src/gridstack.jQueryUI.js
Normal file
|
@ -0,0 +1,97 @@
|
|||
/**
|
||||
* gridstack.js 0.3.0-dev
|
||||
* http://troolee.github.io/gridstack.js/
|
||||
* (c) 2014-2016 Pavel Reznikov, Dylan Weiss
|
||||
* gridstack.js may be freely distributed under the MIT license.
|
||||
* @preserve
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery', 'lodash', 'gridstack', 'jquery-ui/data', 'jquery-ui/disable-selection', 'jquery-ui/focusable',
|
||||
'jquery-ui/form', 'jquery-ui/ie', 'jquery-ui/keycode', 'jquery-ui/labels', 'jquery-ui/jquery-1-7',
|
||||
'jquery-ui/plugin', 'jquery-ui/safe-active-element', 'jquery-ui/safe-blur', 'jquery-ui/scroll-parent',
|
||||
'jquery-ui/tabbable', 'jquery-ui/unique-id', 'jquery-ui/version', 'jquery-ui/widget',
|
||||
'jquery-ui/widgets/mouse', 'jquery-ui/widgets/draggable', 'jquery-ui/widgets/droppable',
|
||||
'jquery-ui/widgets/resizable'], factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
try { jQuery = require('jquery'); } catch (e) {}
|
||||
try { _ = require('lodash'); } catch (e) {}
|
||||
try { GridStackUI = require('gridstack'); } catch (e) {}
|
||||
factory(jQuery, _, GridStackUI);
|
||||
} else {
|
||||
factory(jQuery, _, GridStackUI);
|
||||
}
|
||||
})(function($, _, GridStackUI) {
|
||||
|
||||
var scope = window;
|
||||
|
||||
/**
|
||||
* @class JQueryUIGridStackDragDropPlugin
|
||||
* jQuery UI implementation of drag'n'drop gridstack plugin.
|
||||
*/
|
||||
function JQueryUIGridStackDragDropPlugin(grid) {
|
||||
GridStackUI.GridStackDragDropPlugin.call(this, grid);
|
||||
}
|
||||
|
||||
GridStackUI.GridStackDragDropPlugin.registerPlugin(JQueryUIGridStackDragDropPlugin);
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype = Object.create(GridStackUI.GridStackDragDropPlugin.prototype);
|
||||
JQueryUIGridStackDragDropPlugin.prototype.constructor = JQueryUIGridStackDragDropPlugin;
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.resizable = function(el, opts) {
|
||||
el = $(el);
|
||||
if (opts === 'disable' || opts === 'enable') {
|
||||
el.resizable(opts);
|
||||
} else if (opts === 'option') {
|
||||
var key = arguments[2];
|
||||
var value = arguments[3];
|
||||
el.resizable(opts, key, value);
|
||||
} else {
|
||||
el.resizable(_.extend({}, this.grid.opts.resizable, {
|
||||
start: opts.start || function() {},
|
||||
stop: opts.stop || function() {},
|
||||
resize: opts.resize || function() {}
|
||||
}));
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.draggable = function(el, opts) {
|
||||
el = $(el);
|
||||
if (opts === 'disable' || opts === 'enable') {
|
||||
el.draggable(opts);
|
||||
} else {
|
||||
el.draggable(_.extend({}, this.grid.opts.draggable, {
|
||||
containment: this.grid.opts.isNested ? this.grid.container.parent() : null,
|
||||
start: opts.start || function() {},
|
||||
stop: opts.stop || function() {},
|
||||
drag: opts.drag || function() {}
|
||||
}));
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.droppable = function(el, opts) {
|
||||
el = $(el);
|
||||
if (opts === 'disable' || opts === 'enable') {
|
||||
el.droppable(opts);
|
||||
} else {
|
||||
el.droppable({
|
||||
accept: opts.accept
|
||||
});
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.isDroppable = function(el, opts) {
|
||||
el = $(el);
|
||||
return Boolean(el.data('droppable'));
|
||||
};
|
||||
|
||||
JQueryUIGridStackDragDropPlugin.prototype.on = function(el, eventName, callback) {
|
||||
$(el).on(eventName, callback);
|
||||
return this;
|
||||
};
|
||||
|
||||
return JQueryUIGridStackDragDropPlugin;
|
||||
});
|
224
src/gridstack.js
224
src/gridstack.js
|
@ -1,14 +1,13 @@
|
|||
/**
|
||||
* gridstack.js 0.2.5
|
||||
* gridstack.js 0.3.0-dev
|
||||
* http://troolee.github.io/gridstack.js/
|
||||
* (c) 2014-2016 Pavel Reznikov
|
||||
* (c) 2014-2016 Pavel Reznikov, Dylan Weiss
|
||||
* gridstack.js may be freely distributed under the MIT license.
|
||||
* @preserve
|
||||
*/
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery', 'lodash', 'jquery-ui/core', 'jquery-ui/widget', 'jquery-ui/mouse', 'jquery-ui/draggable',
|
||||
'jquery-ui/resizable'], factory);
|
||||
define(['jquery', 'lodash'], factory);
|
||||
} else if (typeof exports !== 'undefined') {
|
||||
try { jQuery = require('jquery'); } catch (e) {}
|
||||
try { _ = require('lodash'); } catch (e) {}
|
||||
|
@ -120,6 +119,41 @@
|
|||
Utils.insert_css_rule = obsolete(Utils.insertCSSRule, 'insert_css_rule', 'insertCSSRule');
|
||||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
|
||||
/**
|
||||
* @class GridStackDragDropPlugin
|
||||
* Base class for drag'n'drop plugin.
|
||||
*/
|
||||
function GridStackDragDropPlugin(grid) {
|
||||
this.grid = grid;
|
||||
}
|
||||
|
||||
GridStackDragDropPlugin.registeredPlugins = [];
|
||||
|
||||
GridStackDragDropPlugin.registerPlugin = function(pluginClass) {
|
||||
GridStackDragDropPlugin.registeredPlugins.push(pluginClass);
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.resizable = function(el, opts) {
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.draggable = function(el, opts) {
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.droppable = function(el, opts) {
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.isDroppable = function(el) {
|
||||
return false;
|
||||
};
|
||||
|
||||
GridStackDragDropPlugin.prototype.on = function(el, eventName, callback) {
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
var idSeq = 0;
|
||||
|
||||
var GridStackEngine = function(width, onchange, floatMode, height, items) {
|
||||
|
@ -277,12 +311,14 @@
|
|||
};
|
||||
|
||||
GridStackEngine.prototype._notify = function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0);
|
||||
args[0] = typeof args[0] === 'undefined' ? [] : [args[0]];
|
||||
args[1] = typeof args[1] === 'undefined' ? true : args[1];
|
||||
if (this._updateCounter) {
|
||||
return;
|
||||
}
|
||||
var deletedNodes = Array.prototype.slice.call(arguments, 0);
|
||||
deletedNodes = deletedNodes.concat(this.getDirtyNodes());
|
||||
this.onchange(deletedNodes);
|
||||
var deletedNodes = args[0].concat(this.getDirtyNodes());
|
||||
this.onchange(deletedNodes, args[1]);
|
||||
};
|
||||
|
||||
GridStackEngine.prototype.cleanNodes = function() {
|
||||
|
@ -341,12 +377,13 @@
|
|||
node._id = null;
|
||||
this.nodes = _.without(this.nodes, node);
|
||||
this._packNodes();
|
||||
if (detachNode) {
|
||||
this._notify(node);
|
||||
}
|
||||
this._notify(node, detachNode);
|
||||
};
|
||||
|
||||
GridStackEngine.prototype.canMoveNode = function(node, x, y, width, height) {
|
||||
if (!this.isNodeChangedPosition(node, x, y, width, height)) {
|
||||
return false;
|
||||
}
|
||||
var hasLocked = Boolean(_.find(this.nodes, function(n) { return n.locked; }));
|
||||
|
||||
if (!this.height && !hasLocked) {
|
||||
|
@ -402,7 +439,27 @@
|
|||
return clone.getGridHeight() <= this.height;
|
||||
};
|
||||
|
||||
GridStackEngine.prototype.isNodeChangedPosition = function(node, x, y, width, height) {
|
||||
if (typeof x != 'number') { x = node.x; }
|
||||
if (typeof y != 'number') { y = node.y; }
|
||||
if (typeof width != 'number') { width = node.width; }
|
||||
if (typeof height != 'number') { height = node.height; }
|
||||
|
||||
if (typeof node.maxWidth != 'undefined') { width = Math.min(width, node.maxWidth); }
|
||||
if (typeof node.maxHeight != 'undefined') { height = Math.min(height, node.maxHeight); }
|
||||
if (typeof node.minWidth != 'undefined') { width = Math.max(width, node.minWidth); }
|
||||
if (typeof node.minHeight != 'undefined') { height = Math.max(height, node.minHeight); }
|
||||
|
||||
if (node.x == x && node.y == y && node.width == width && node.height == height) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
GridStackEngine.prototype.moveNode = function(node, x, y, width, height, noPack) {
|
||||
if (!this.isNodeChangedPosition(node, x, y, width, height)) {
|
||||
return node;
|
||||
}
|
||||
if (typeof x != 'number') { x = node.x; }
|
||||
if (typeof y != 'number') { y = node.y; }
|
||||
if (typeof width != 'number') { width = node.width; }
|
||||
|
@ -425,6 +482,11 @@
|
|||
node.width = width;
|
||||
node.height = height;
|
||||
|
||||
node.lastTriedX = x;
|
||||
node.lastTriedY = y;
|
||||
node.lastTriedWidth = width;
|
||||
node.lastTriedHeight = height;
|
||||
|
||||
node = this._prepareNode(node, resizing);
|
||||
|
||||
this._fixCollisions(node);
|
||||
|
@ -508,7 +570,7 @@
|
|||
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
|
||||
|
||||
opts.itemClass = opts.itemClass || 'grid-stack-item';
|
||||
var isNested = this.container.closest('.' + opts.itemClass).size() > 0;
|
||||
var isNested = this.container.closest('.' + opts.itemClass).length > 0;
|
||||
|
||||
this.opts = _.defaults(opts || {}, {
|
||||
width: parseInt(this.container.attr('data-gs-width')) || 12,
|
||||
|
@ -543,9 +605,19 @@
|
|||
removable: false,
|
||||
removeTimeout: 2000,
|
||||
verticalMarginUnit: 'px',
|
||||
cellHeightUnit: 'px'
|
||||
cellHeightUnit: 'px',
|
||||
oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode',
|
||||
ddPlugin: null
|
||||
});
|
||||
|
||||
if (this.opts.ddPlugin === false) {
|
||||
this.opts.ddPlugin = GridStackDragDropPlugin;
|
||||
} else if (this.opts.ddPlugin === null) {
|
||||
this.opts.ddPlugin = _.first(GridStackDragDropPlugin.registeredPlugins) || GridStackDragDropPlugin;
|
||||
}
|
||||
|
||||
this.dd = new this.opts.ddPlugin(this);
|
||||
|
||||
if (this.opts.rtl === 'auto') {
|
||||
this.opts.rtl = this.container.css('direction') === 'rtl';
|
||||
}
|
||||
|
@ -574,10 +646,11 @@
|
|||
|
||||
this._initStyles();
|
||||
|
||||
this.grid = new GridStackEngine(this.opts.width, function(nodes) {
|
||||
this.grid = new GridStackEngine(this.opts.width, function(nodes, detachNode) {
|
||||
detachNode = typeof detachNode === 'undefined' ? true : detachNode;
|
||||
var maxHeight = 0;
|
||||
_.each(nodes, function(n) {
|
||||
if (n._id === null) {
|
||||
if (detachNode && n._id === null) {
|
||||
if (n.el) {
|
||||
n.el.remove();
|
||||
}
|
||||
|
@ -630,7 +703,7 @@
|
|||
if (oneColumnMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.container.addClass(self.opts.oneColumnModeClass);
|
||||
oneColumnMode = true;
|
||||
|
||||
self.grid._sortNodes();
|
||||
|
@ -641,17 +714,20 @@
|
|||
return;
|
||||
}
|
||||
if (node.noMove || self.opts.disableDrag) {
|
||||
node.el.draggable('disable');
|
||||
self.dd.draggable(node.el, 'disable');
|
||||
}
|
||||
if (node.noResize || self.opts.disableResize) {
|
||||
node.el.resizable('disable');
|
||||
self.dd.resizable(node.el, 'disable');
|
||||
}
|
||||
|
||||
node.el.trigger('resize');
|
||||
});
|
||||
} else {
|
||||
if (!oneColumnMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.container.removeClass(self.opts.oneColumnModeClass);
|
||||
oneColumnMode = false;
|
||||
|
||||
if (self.opts.staticGrid) {
|
||||
|
@ -660,11 +736,13 @@
|
|||
|
||||
_.each(self.grid.nodes, function(node) {
|
||||
if (!node.noMove && !self.opts.disableDrag) {
|
||||
node.el.draggable('enable');
|
||||
self.dd.draggable(node.el, 'enable');
|
||||
}
|
||||
if (!node.noResize && !self.opts.disableResize) {
|
||||
node.el.resizable('enable');
|
||||
self.dd.resizable(node.el, 'enable');
|
||||
}
|
||||
|
||||
node.el.trigger('resize');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -672,15 +750,15 @@
|
|||
$(window).resize(this.onResizeHandler);
|
||||
this.onResizeHandler();
|
||||
|
||||
if (typeof self.opts.removable === 'string') {
|
||||
if (!self.opts.staticGrid && typeof self.opts.removable === 'string') {
|
||||
var trashZone = $(self.opts.removable);
|
||||
if (!trashZone.data('droppable')) {
|
||||
trashZone.droppable({
|
||||
if (!this.dd.isDroppable(trashZone)) {
|
||||
this.dd.droppable(trashZone, {
|
||||
accept: '.' + self.opts.itemClass
|
||||
});
|
||||
}
|
||||
trashZone
|
||||
.on('dropover', function(event, ui) {
|
||||
this.dd
|
||||
.on(trashZone, 'dropover', function(event, ui) {
|
||||
var el = $(ui.draggable);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (node._grid !== self) {
|
||||
|
@ -688,7 +766,7 @@
|
|||
}
|
||||
self._setupRemovingTimeout(el);
|
||||
})
|
||||
.on('dropout', function(event, ui) {
|
||||
.on(trashZone, 'dropout', function(event, ui) {
|
||||
var el = $(ui.draggable);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (node._grid !== self) {
|
||||
|
@ -698,7 +776,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
if (self.opts.acceptWidgets) {
|
||||
if (!self.opts.staticGrid && self.opts.acceptWidgets) {
|
||||
var draggingElement = null;
|
||||
|
||||
var onDrag = function(event, ui) {
|
||||
|
@ -738,16 +816,18 @@
|
|||
}
|
||||
};
|
||||
|
||||
$(self.container).droppable({
|
||||
accept: function(el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (node && node._grid === self) {
|
||||
return false;
|
||||
this.dd
|
||||
.droppable(self.container, {
|
||||
accept: function(el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (node && node._grid === self) {
|
||||
return false;
|
||||
}
|
||||
return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets);
|
||||
}
|
||||
return el.is(self.opts.acceptWidgets === true ? '.grid-stack-item' : self.opts.acceptWidgets);
|
||||
},
|
||||
over: function(event, ui) {
|
||||
})
|
||||
.on(self.container, 'dropover', function(event, ui) {
|
||||
var offset = self.container.offset();
|
||||
var el = $(ui.draggable);
|
||||
var cellWidth = self.cellWidth();
|
||||
|
@ -764,8 +844,8 @@
|
|||
el.data('_gridstack_node_orig', origNode);
|
||||
|
||||
el.on('drag', onDrag);
|
||||
},
|
||||
out: function(event, ui) {
|
||||
})
|
||||
.on(self.container, 'dropout', function(event, ui) {
|
||||
var el = $(ui.draggable);
|
||||
el.unbind('drag', onDrag);
|
||||
var node = el.data('_gridstack_node');
|
||||
|
@ -774,8 +854,8 @@
|
|||
self.placeholder.detach();
|
||||
self._updateContainerHeight();
|
||||
el.data('_gridstack_node', el.data('_gridstack_node_orig'));
|
||||
},
|
||||
drop: function(event, ui) {
|
||||
})
|
||||
.on(self.container, 'drop', function(event, ui) {
|
||||
self.placeholder.detach();
|
||||
|
||||
var node = $(ui.draggable).data('_gridstack_node');
|
||||
|
@ -797,13 +877,12 @@
|
|||
.removeClass('ui-draggable ui-draggable-dragging ui-draggable-disabled')
|
||||
.unbind('drag', onDrag);
|
||||
self.container.append(el);
|
||||
self._prepareElementByNode(el, node);
|
||||
self._prepareElementsByNode(el, node);
|
||||
self._updateContainerHeight();
|
||||
self._triggerChangeEvent();
|
||||
|
||||
self.grid.endUpdate();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -965,7 +1044,10 @@
|
|||
node._isAboutToRemove = false;
|
||||
};
|
||||
|
||||
GridStack.prototype._prepareElementByNode = function(el, node) {
|
||||
GridStack.prototype._prepareElementsByNode = function(el, node) {
|
||||
if (typeof $.ui === 'undefined') {
|
||||
return;
|
||||
}
|
||||
var self = this;
|
||||
|
||||
var cellWidth;
|
||||
|
@ -1018,10 +1100,18 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!self.grid.canMoveNode(node, x, y, width, height)) {
|
||||
// width and height are undefined if not resizing
|
||||
var lastTriedWidth = typeof width !== 'undefined' ? width : node.lastTriedWidth;
|
||||
var lastTriedHeight = typeof height !== 'undefined' ? height : node.lastTriedHeight;
|
||||
if (!self.grid.canMoveNode(node, x, y, width, height) ||
|
||||
(node.lastTriedX === x && node.lastTriedY === y &&
|
||||
node.lastTriedWidth === lastTriedWidth && node.lastTriedHeight === lastTriedHeight)) {
|
||||
return;
|
||||
}
|
||||
node.lastTriedX = x;
|
||||
node.lastTriedY = y;
|
||||
node.lastTriedWidth = width;
|
||||
node.lastTriedHeight = height;
|
||||
self.grid.moveNode(node, x, y, width, height);
|
||||
self._updateContainerHeight();
|
||||
};
|
||||
|
@ -1031,7 +1121,7 @@
|
|||
var o = $(this);
|
||||
self.grid.cleanNodes();
|
||||
self.grid.beginUpdate(node);
|
||||
cellWidth = Math.ceil(o.outerWidth() / o.attr('data-gs-width'));
|
||||
cellWidth = self.cellWidth();
|
||||
var strictCellHeight = Math.ceil(o.outerHeight() / o.attr('data-gs-height'));
|
||||
cellHeight = self.container.height() / parseInt(self.container.attr('data-gs-current-height'));
|
||||
self.placeholder
|
||||
|
@ -1044,8 +1134,8 @@
|
|||
node._beforeDragX = node.x;
|
||||
node._beforeDragY = node.y;
|
||||
|
||||
el.resizable('option', 'minWidth', cellWidth * (node.minWidth || 1));
|
||||
el.resizable('option', 'minHeight', strictCellHeight * (node.minHeight || 1));
|
||||
self.dd.resizable(el, 'option', 'minWidth', cellWidth * (node.minWidth || 1));
|
||||
self.dd.resizable(el, 'option', 'minHeight', strictCellHeight * (node.minHeight || 1));
|
||||
|
||||
if (event.type == 'resizestart') {
|
||||
o.find('.grid-stack-item').trigger('resizestart');
|
||||
|
@ -1102,25 +1192,24 @@
|
|||
}
|
||||
};
|
||||
|
||||
el
|
||||
.draggable(_.extend(this.opts.draggable, {
|
||||
containment: this.opts.isNested ? this.container.parent() : null,
|
||||
this.dd
|
||||
.draggable(el, {
|
||||
start: onStartMoving,
|
||||
stop: onEndMoving,
|
||||
drag: dragOrResize
|
||||
}))
|
||||
.resizable(_.extend(this.opts.resizable, {
|
||||
})
|
||||
.resizable(el, {
|
||||
start: onStartMoving,
|
||||
stop: onEndMoving,
|
||||
resize: dragOrResize
|
||||
}));
|
||||
});
|
||||
|
||||
if (node.noMove || this._isOneColumnMode() || this.opts.staticGrid || this.opts.disableDrag) {
|
||||
el.draggable('disable');
|
||||
if (node.noMove || this._isOneColumnMode() || this.opts.disableDrag) {
|
||||
this.dd.draggable(el, 'disable');
|
||||
}
|
||||
|
||||
if (node.noResize || this._isOneColumnMode() || this.opts.staticGrid || this.opts.disableResize) {
|
||||
el.resizable('disable');
|
||||
if (node.noResize || this._isOneColumnMode() || this.opts.disableResize) {
|
||||
this.dd.resizable(el, 'disable');
|
||||
}
|
||||
|
||||
el.attr('data-gs-locked', node.locked ? 'yes' : null);
|
||||
|
@ -1151,7 +1240,7 @@
|
|||
}, triggerAddEvent);
|
||||
el.data('_gridstack_node', node);
|
||||
|
||||
this._prepareElementByNode(el, node);
|
||||
this._prepareElementsByNode(el, node);
|
||||
};
|
||||
|
||||
GridStack.prototype.setAnimation = function(enable) {
|
||||
|
@ -1232,6 +1321,7 @@
|
|||
this.disable();
|
||||
if (typeof detachGrid != 'undefined' && !detachGrid) {
|
||||
this.removeAll(false);
|
||||
this.container.removeData('gridstack');
|
||||
} else {
|
||||
this.container.remove();
|
||||
}
|
||||
|
@ -1247,15 +1337,15 @@
|
|||
el.each(function(index, el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (typeof node == 'undefined' || node === null) {
|
||||
if (typeof node == 'undefined' || node === null || typeof $.ui === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
node.noResize = !(val || false);
|
||||
if (node.noResize || self._isOneColumnMode()) {
|
||||
el.resizable('disable');
|
||||
self.dd.resizable(el, 'disable');
|
||||
} else {
|
||||
el.resizable('enable');
|
||||
self.dd.resizable(el, 'enable');
|
||||
}
|
||||
});
|
||||
return this;
|
||||
|
@ -1267,16 +1357,16 @@
|
|||
el.each(function(index, el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (typeof node == 'undefined' || node === null) {
|
||||
if (typeof node == 'undefined' || node === null || typeof $.ui === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
node.noMove = !(val || false);
|
||||
if (node.noMove || self._isOneColumnMode()) {
|
||||
el.draggable('disable');
|
||||
self.dd.draggable(el, 'disable');
|
||||
el.removeClass('ui-draggable-handle');
|
||||
} else {
|
||||
el.draggable('enable');
|
||||
self.dd.draggable(el, 'enable');
|
||||
el.addClass('ui-draggable-handle');
|
||||
}
|
||||
});
|
||||
|
@ -1482,8 +1572,7 @@
|
|||
};
|
||||
|
||||
GridStack.prototype.cellWidth = function() {
|
||||
var o = this.container.children('.' + this.opts.itemClass).first();
|
||||
return Math.ceil(o.outerWidth() / parseInt(o.attr('data-gs-width'), 10));
|
||||
return Math.round(this.container.outerWidth() / this.opts.width);
|
||||
};
|
||||
|
||||
GridStack.prototype.getCellFromPixel = function(position, useOffset) {
|
||||
|
@ -1633,6 +1722,7 @@
|
|||
|
||||
scope.GridStackUI.Utils = Utils;
|
||||
scope.GridStackUI.Engine = GridStackEngine;
|
||||
scope.GridStackUI.GridStackDragDropPlugin = GridStackDragDropPlugin;
|
||||
|
||||
$.fn.gridstack = function(opts) {
|
||||
return this.each(function() {
|
||||
|
|
|
@ -79,7 +79,7 @@ $animation_speed: .3s !default;
|
|||
|
||||
> .ui-resizable-se,
|
||||
> .ui-resizable-sw {
|
||||
background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
||||
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
@include vendor(transform, rotate(45deg));
|
||||
|
@ -123,18 +123,18 @@ $animation_speed: .3s !default;
|
|||
&.grid-stack-animate .grid-stack-item.grid-stack-placeholder{
|
||||
@include vendor(transition, left .0s, top .0s, height .0s, width .0s);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.grid-stack-item {
|
||||
position: relative !important;
|
||||
width: auto !important;
|
||||
left: 0 !important;
|
||||
top: auto !important;
|
||||
margin-bottom: $vertical_padding;
|
||||
|
||||
.ui-resizable-handle { display: none; }
|
||||
}
|
||||
|
||||
.grid-stack { height: auto !important; }
|
||||
|
||||
&.grid-stack-one-column-mode {
|
||||
height: auto !important;
|
||||
&> .grid-stack-item {
|
||||
position: relative !important;
|
||||
width: auto !important;
|
||||
left: 0 !important;
|
||||
top: auto !important;
|
||||
margin-bottom: $vertical_padding;
|
||||
max-width: none !important;
|
||||
|
||||
&> .ui-resizable-handle { display: none; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue