diff --git a/.travis.yml b/.travis.yml index f8cde4730..9e3585595 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: -- 5.7.0 +- 7.7.2 env: - CXX=g++-4.8 addons: @@ -10,11 +10,12 @@ addons: packages: - g++-4.8 before_install: -- npm install -g protractor +- npm install -g protractor@3.3.0 install: - npm install -g npm@2 - npm install -g grunt-cli - npm install -g bower +- npm install selenium-webdriver - bower install - npm install - ./node_modules/protractor/bin/webdriver-manager update --standalone @@ -25,7 +26,7 @@ before_script: script: - npm run build - npm test -- grunt e2e-test +# - grunt e2e-test notifications: slack: secure: iGLGsYyVIyKVpVVCskGh/zc6Pkqe0D7jpUtbywSbnq6l5seE6bvBVqm0F2FSCIN+AIC+qal2mPEWysDVsLACm5tTEeA8NfL8dmCrAKbiFbi+gHl4mnHHCHl7ii/7UkoIIXNc5UXbgMSXRS5l8UcsSDlN8VxC5zWstbJvjeYIvbA= diff --git a/Gruntfile.js b/Gruntfile.js index 77f58d42e..832383212 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,139 +1,111 @@ -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -module.exports = function(grunt) { - grunt.loadNpmTasks('grunt-sass'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-doctoc'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-jscs'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-protractor-runner'); - grunt.loadNpmTasks('grunt-contrib-connect'); - grunt.loadNpmTasks('grunt-protractor-webdriver'); - - grunt.initConfig({ - sass: { - options: { - outputStyle: 'expanded' - }, - dist: { - files: { - 'dist/gridstack.css': 'src/gridstack.scss', - 'dist/gridstack-extra.css': 'src/gridstack-extra.scss' - } - } - }, - - cssmin: { - dist: { - files: { - 'dist/gridstack.min.css': ['dist/gridstack.css'], - 'dist/gridstack-extra.min.css': ['dist/gridstack-extra.css'] - } - } - }, - - copy: { - dist: { - files: { - 'dist/gridstack.js': ['src/gridstack.js'], - 'dist/gridstack.jQueryUI.js': ['src/gridstack.jQueryUI.js'], - } - } - }, - - uglify: { - options: { - sourceMap: true, - sourceMapName: 'dist/gridstack.min.map', - preserveComments: 'some' - }, - dist: { - files: { - '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'] - } - } - }, - - doctoc: { - options: { - removeAd: false - }, - readme: { - options: { - target: './README.md' - } - }, - doc: { - options: { - target: './doc/README.md' - } - }, - faq: { - options: { - target: './doc/FAQ.md' - } - }, - }, - - jshint: { - all: ['src/*.js'] - }, - - jscs: { - all: ['*.js', 'src/*.js', ], - }, - - watch: { - scripts: { - files: ['src/*.js'], - tasks: ['uglify', 'copy'], - options: { - }, - }, - styles: { - files: ['src/*.scss'], - tasks: ['sass', 'cssmin'], - options: { - }, - }, - docs: { - files: ['README.md', 'doc/README.md', 'doc/FAQ.md'], - tasks: ['doctoc'], - options: { - }, - }, - }, - - protractor: { - options: { - configFile: 'protractor.conf.js', - }, - all: {} - }, - - connect: { - all: { - options: { - port: 8080, - hostname: 'localhost', - base: '.', - }, - }, - }, - - protractor_webdriver: { - all: { - options: { - command: 'webdriver-manager start', - } - } - } - }); - - grunt.registerTask('default', ['sass', 'cssmin', 'jshint', 'jscs', 'copy', 'uglify', 'doctoc']); - grunt.registerTask('e2e-test', ['connect', 'protractor_webdriver', 'protractor']); -}; +// jscs:disable requireCamelCaseOrUpperCaseIdentifiers +module.exports = function(grunt) { + grunt.loadNpmTasks('grunt-sass'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-jscs'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-protractor-runner'); + grunt.loadNpmTasks('grunt-contrib-connect'); + grunt.loadNpmTasks('grunt-protractor-webdriver'); + + grunt.initConfig({ + sass: { + options: { + outputStyle: 'expanded' + }, + dist: { + files: { + 'dist/gridstack.css': 'src/gridstack.scss', + 'dist/gridstack-extra.css': 'src/gridstack-extra.scss' + } + } + }, + + cssmin: { + dist: { + files: { + 'dist/gridstack.min.css': ['dist/gridstack.css'], + 'dist/gridstack-extra.min.css': ['dist/gridstack-extra.css'] + } + } + }, + + copy: { + dist: { + files: { + 'dist/gridstack.js': ['src/gridstack.js'], + 'dist/gridstack.jQueryUI.js': ['src/gridstack.jQueryUI.js'], + } + } + }, + + uglify: { + options: { + sourceMap: true, + sourceMapName: 'dist/gridstack.min.map', + preserveComments: 'some' + }, + dist: { + files: { + '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'] + } + } + }, + + jshint: { + all: ['src/*.js'] + }, + + jscs: { + all: ['*.js', 'src/*.js', ], + }, + + watch: { + scripts: { + files: ['src/*.js'], + tasks: ['uglify', 'copy'], + options: { + }, + }, + styles: { + files: ['src/*.scss'], + tasks: ['sass', 'cssmin'], + options: { + }, + } + }, + + protractor: { + options: { + configFile: 'protractor.conf.js', + }, + all: {} + }, + + connect: { + all: { + options: { + port: 8080, + hostname: 'localhost', + base: '.', + }, + }, + }, + + protractor_webdriver: { + all: { + options: { + command: 'webdriver-manager start', + } + } + } + }); + + grunt.registerTask('default', ['sass', 'cssmin', 'jshint', 'jscs', 'copy', 'uglify']); + grunt.registerTask('e2e-test', ['connect', 'protractor_webdriver', 'protractor']); +}; diff --git a/LICENSE b/LICENSE index f337ebad1..d8ca1d3a7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2016 Pavel Reznikov, Dylan Weiss +Copyright (c) 2014-2017 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 diff --git a/README.md b/README.md index bd409d011..1bf790473 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,8 @@ gridstack.js [![Coverage Status](https://coveralls.io/repos/github/troolee/gridstack.js/badge.svg?branch=master)](https://coveralls.io/github/troolee/gridstack.js?branch=master) [![Dependency Status](https://david-dm.org/troolee/gridstack.js.svg)](https://david-dm.org/troolee/gridstack.js) [![devDependency Status](https://david-dm.org/troolee/gridstack.js/dev-status.svg)](https://david-dm.org/troolee/gridstack.js#info=devDependencies) -[![Stories in Ready](https://badge.waffle.io/troolee/gridstack.js.png?label=ready&title=Ready)](http://waffle.io/troolee/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](https://github.com/ducksboard/gridster.js). Built with love. +gridstack.js is a mobile-friendly Javascript library for dashboard layout and creation. Making a drag-and-drop, multi-column dashboard has never been easier. gridstack.js 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), [ember](https://www.emberjs.com/). Join gridstack.js on Slack: https://gridstackjs.troolee.com @@ -20,51 +16,40 @@ Join gridstack.js on Slack: https://gridstackjs.troolee.com **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* -- [Demo](#demo) +- [gridstack.js News](#gridstackjs-news) +- [Demo and examples](#demo-and-examples) - [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) - - [Rails integration](#rails-integration) + - [gridstack.js for specific frameworks](#gridstackjs-for-specific-frameworks) - [Change grid width](#change-grid-width) - [Extra CSS](#extra-css) - [Different grid widths](#different-grid-widths) - - [Save grid to array](#save-grid-to-array) - - [Load grid from array](#load-grid-from-array) - [Override resizable/draggable options](#override-resizabledraggable-options) - [IE8 support](#ie8-support) - [Use with require.js](#use-with-requirejs) - - [Nested grids](#nested-grids) - - [Resizing active grid](#resizing-active-grid) - - [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) - - [v0.2.2 (2014-12-23)](#v022-2014-12-23) - - [v0.2.1 (2014-12-09)](#v021-2014-12-09) - - [v0.2.0 (2014-11-30)](#v020-2014-11-30) - - [v0.1.0 (2014-11-18)](#v010-2014-11-18) -- [License](#license) +- [The Team](#the-team) -Demo +gridstack.js News +===== + +Version 1.0 is coming! Check out the blog post here for more information: +[https://dylandreams.com/2017/04/26/gridstack-10-coming-soon/](https://dylandreams.com/2017/04/26/gridstack-10-coming-soon/) and [subscribe to the blog](https://dylandreams.com) for more gridstack news and tutorials. + + +Demo and examples ==== -Please visit http://troolee.github.io/gridstack.js/ for demo. Or check out [these example](http://troolee.github.io/gridstack.js/demo/). +Please visit http://troolee.github.io/gridstack.js/ for a demo or check out [these examples](http://troolee.github.io/gridstack.js/demo/). Usage @@ -84,6 +69,8 @@ Note: You can still use [underscore.js](http://underscorejs.org) (>= 1.7.0) inst ## Install +* In the browser: + ```html @@ -131,15 +118,12 @@ You can download files from `dist` directory as well. ``` + ## 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. @@ -159,22 +143,11 @@ or 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). -All old methods and parameters are marked as deprecated and still available but a warning will be displayed in js console. They will be available until v1.0 -when they will be completely removed. ## API Documentation -Please check out `doc/README.md` for more information about gridstack.js API. +Documentation can be found [here](https://github.com/troolee/gridstack.js/tree/develop/doc). -## 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 @@ -203,93 +176,12 @@ $(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 -ko.components.register('dashboard-grid', { - viewModel: { - createViewModel: function (controller, componentInfo) { - var ViewModel = function (controller, componentInfo) { - var grid = null; - - this.widgets = controller.widgets; - - this.afterAddWidget = function (items) { - if (grid == null) { - grid = $(componentInfo.element).find('.grid-stack').gridstack({ - auto: false - }).data('gridstack'); - } - - var item = _.find(items, function (i) { return i.nodeType == 1 }); - grid.addWidget(item); - ko.utils.domNodeDisposal.addDisposeCallback(item, function () { - grid.removeWidget(item); - }); - }; - }; - - return new ViewModel(controller, componentInfo); - } - }, - template: - [ - '
', - '
', - '
...
', - '
', - '
' - ].join('') -}); - -$(function () { - var Controller = function (widgets) { - this.widgets = ko.observableArray(widgets); - }; - - var widgets = [ - {x: 0, y: 0, width: 2, height: 2}, - {x: 2, y: 0, width: 4, height: 2}, - {x: 6, y: 0, width: 2, height: 4}, - {x: 1, y: 2, width: 4, height: 2} - ]; - - ko.applyBindings(new Controller(widgets)); -}); -``` - -and HTML: - -```html -
-``` - -See examples: [example 1](http://troolee.github.io/gridstack.js/demo/knockout.html), [example 2](http://troolee.github.io/gridstack.js/demo/knockout2.html). - -**Notes:** It's very important to exclude training spaces after widget template: - -```javascript -template: - [ - '
', - '
', - ' ....', - '
', // <-- NO SPACE **AFTER**
- ' ' // <-- NO SPACE **BEFORE** - ].join('') // <-- JOIN WITH **EMPTY** STRING -``` +## gridstack.js for specific frameworks -Otherwise `addDisposeCallback` won't work. - - -## Use with angular.js - -Please check [gridstack-angular](https://github.com/kdietrich/gridstack-angular) - - -## Rails integration - -For rails users, integration of gridstack.js and its dependencies can be done through [gridstack-js-rails](https://github.com/randoum/gridstack-js-rails) +- AngularJS: [gridstack-angular](https://github.com/kdietrich/gridstack-angular) +- Rails: [gridstack-js-rails](https://github.com/randoum/gridstack-js-rails) +- ember: [gridstack-ember](https://github.com/yahoo/ember-gridstack) ## Change grid width @@ -358,60 +250,6 @@ $('.grid-stack').gridstack({width: N}); See example: [2 grids demo](http://troolee.github.io/gridstack.js/demo/two.html) -## Save grid to array - -Because gridstack doesn't track any kind of user-defined widget id there is no reason to make serialization to be part -of gridstack API. To serialize grid you can simply do something like this (let's say you store widget id inside `data-custom-id` -attribute): - -```javascript -var res = _.map($('.grid-stack .grid-stack-item:visible'), function (el) { - el = $(el); - var node = el.data('_gridstack_node'); - return { - id: el.attr('data-custom-id'), - x: node.x, - y: node.y, - width: node.width, - height: node.height - }; -}); -alert(JSON.stringify(res)); -``` - -See example: [Serialization demo](http://troolee.github.io/gridstack.js/demo/serialization.html) - -You can also use `onchange` event if you need to save only changed widgets right away they have been changed. - -## Load grid from array - -```javascript -var serialization = [ - {x: 0, y: 0, width: 2, height: 2}, - {x: 3, y: 1, width: 1, height: 2}, - {x: 4, y: 1, width: 1, height: 1}, - {x: 2, y: 3, width: 3, height: 1}, - {x: 1, y: 4, width: 1, height: 1}, - {x: 1, y: 3, width: 1, height: 1}, - {x: 2, y: 4, width: 1, height: 1}, - {x: 2, y: 5, width: 1, height: 1} -]; - -serialization = GridStackUI.Utils.sort(serialization); - -var grid = $('.grid-stack').data('gridstack'); -grid.removeAll(); - -_.each(serialization, function (node) { - grid.addWidget($('
'), - node.x, node.y, node.width, node.height); -}); -``` - -See example: [Serialization demo](http://troolee.github.io/gridstack.js/demo/serialization.html) - -If you're using knockout there is no need for such method at all. - ## Override resizable/draggable options You can override default `resizable`/`draggable` options. For instance to enable other then bottom right resizing handle @@ -478,159 +316,13 @@ If you're using require.js and a single file jQueryUI please check out this [Stackoverflow question](http://stackoverflow.com/questions/35582945/redundant-dependencies-with-requirejs) to get it working properly. +Changes +===== -## Nested grids - -Gridstack may be nested. All nested grids have an additional class `grid-stack-nested` which is assigned automatically -during initialization. -See example: [Nested grid demo](http://troolee.github.io/gridstack.js/demo/nested.html) - - -## Resizing active grid - -Resizing on-the-fly is possible, though experimental. This may be used to make gridstack responsive. gridstack will change the total number of columns and will attempt to update the width and x values of each widget to be more logical. -See example: [Responsive grid demo](http://troolee.github.io/gridstack.js/demo/responsive.html) - -## Using AniJS +View our change log [here](https://github.com/troolee/gridstack.js/tree/develop/doc/CHANGES.md). -Using AniJS with gridstack is a breeze. In the following example, a listener is added that gets triggered by a widget being added. -See widgets wiggle! [AniJS demo](http://troolee.github.io/gridstack.js/demo/anijs.html) The Team ======== -gridstack.js is currently maintained by [Pavel Reznikov](https://github.com/troolee), [Dylan Weiss](https://github.com/radiolips) -and [Kevin Dietrich](https://github.com/kdietrich). And we appreciate [all contributors](https://github.com/troolee/gridstack.js/graphs/contributors) -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. -- `cellHeight` and `verticalMargin` can now be string (e.g. '3em', '20px') (Thanks to @jlowcs). -- add `maxWidth`/`maxHeight` methods. -- add `enableMove`/`enableResize` methods. -- fix window resize issue #331. -- add options `disableDrag` and `disableResize`. -- fix `batchUpdate`/`commit` (Thank to @radiolips) -- remove dependency of FontAwesome -- RTL support -- `'auto'` value for `cellHeight` option -- fix `setStatic` method -- add `setAnimation` method to API -- add `setGridWidth` method ([#227](https://github.com/troolee/gridstack.js/issues/227)) -- add `removable`/`removeTimeout` *(experimental)* -- add `detachGrid` parameter to `destroy` method ([#216](https://github.com/troolee/gridstack.js/issues/216)) (thanks @jhpedemonte) -- add `useOffset` parameter to `getCellFromPixel` method ([#237](https://github.com/troolee/gridstack.js/issues/237)) -- add `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `id` parameters to `addWidget` ([#188](https://github.com/troolee/gridstack.js/issues/188)) -- add `added` and `removed` events for when a widget is added or removed, respectively. ([#54](https://github.com/troolee/gridstack.js/issues/54)) -- add `acceptWidgets` parameter. Widgets can now be draggable between grids or from outside *(experimental)* - -#### v0.2.4 (2016-02-15) - -- fix closure compiler/linter warnings -- add `static_grid` option. -- add `min_width`/`min_height` methods (Thanks to @cvillemure) -- add `destroy` method (Thanks to @zspitzer) -- add `placeholder_text` option (Thanks to @slauyama) -- add `handle_class` option. -- add `make_widget` method. -- lodash v 4.x support (Thanks to @andrewr88) - -#### v0.2.3 (2015-06-23) - -- gridstack-extra.css -- add support of lodash.js -- add `is_area_empty` method -- nested grids -- add `batch_update`/`commit` methods -- add `update` method -- allow to override `resizable`/`draggable` options -- add `disable`/`enable` methods -- add `get_cell_from_pixel` (thanks to @juchi) -- AMD support -- fix nodes sorting -- improved touch devices support -- add `always_show_resize_handle` option -- minor fixes and improvements - -#### v0.2.2 (2014-12-23) - -- fix grid initialization -- add `cell_height`/`cell_width` API methods -- fix boolean attributes (issue #31) - -#### v0.2.1 (2014-12-09) - -- add widgets locking (issue #19) -- add `will_it_fit` API method -- fix auto-positioning (issue #20) -- add animation (thanks to @ishields) -- fix `y` coordinate calculation when dragging (issue #18) -- fix `remove_widget` (issue #16) -- minor fixes - - -#### v0.2.0 (2014-11-30) - -- add `height` option -- auto-generate css rules (widgets `height` and `top`) -- add `GridStackUI.Utils.sort` utility function -- add `remove_all` API method -- add `resize` and `move` API methods -- add `resizable` and `movable` API methods -- add `data-gs-no-move` attribute -- add `float` option -- fix default css rule for inner content -- minor fixes - -#### v0.1.0 (2014-11-18) - -Very first version. - - -License -======= - -The MIT License (MIT) - -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 -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -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. +gridstack.js is currently maintained by [Pavel Reznikov](https://github.com/troolee) and [Dylan Weiss](https://github.com/radiolips). We appreciate [all contributors](https://github.com/troolee/gridstack.js/graphs/contributors) for help. diff --git a/bower.json b/bower.json index 205d92687..b125c3835 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "gridstack", - "version": "0.3.0-dev", + "version": "1.0.0-dev", "homepage": "https://github.com/troolee/gridstack.js", "authors": [ "Pavel Reznikov " diff --git a/dist/gridstack-extra.min.css b/dist/gridstack-extra.min.css index 074f4d56c..8a29cc21d 100644 --- a/dist/gridstack-extra.min.css +++ b/dist/gridstack-extra.min.css @@ -1 +1 @@ -.grid-stack.grid-stack-1>.grid-stack-item,.grid-stack.grid-stack-1>.grid-stack-item[data-gs-min-width='1']{min-width:100%}.grid-stack.grid-stack-1>.grid-stack-item[data-gs-width='1']{width:100%}.grid-stack.grid-stack-1>.grid-stack-item[data-gs-x='1']{left:100%}.grid-stack.grid-stack-2>.grid-stack-item,.grid-stack.grid-stack-2>.grid-stack-item[data-gs-min-width='1']{min-width:50%}.grid-stack.grid-stack-1>.grid-stack-item[data-gs-max-width='1']{max-width:100%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-width='1']{width:50%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-x='1']{left:50%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-max-width='1']{max-width:50%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-width='2']{width:100%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-x='2']{left:100%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-min-width='2']{min-width:100%}.grid-stack.grid-stack-3>.grid-stack-item,.grid-stack.grid-stack-3>.grid-stack-item[data-gs-min-width='1']{min-width:33.3333333333%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-max-width='2']{max-width:100%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-width='1']{width:33.3333333333%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-x='1']{left:33.3333333333%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-max-width='1']{max-width:33.3333333333%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-width='2']{width:66.6666666667%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-x='2']{left:66.6666666667%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-min-width='2']{min-width:66.6666666667%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-max-width='2']{max-width:66.6666666667%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-width='3']{width:100%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-x='3']{left:100%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-min-width='3']{min-width:100%}.grid-stack.grid-stack-4>.grid-stack-item,.grid-stack.grid-stack-4>.grid-stack-item[data-gs-min-width='1']{min-width:25%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-max-width='3']{max-width:100%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-width='1']{width:25%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-x='1']{left:25%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-max-width='1']{max-width:25%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-width='2']{width:50%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-x='2']{left:50%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-min-width='2']{min-width:50%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-max-width='2']{max-width:50%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-width='3']{width:75%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-x='3']{left:75%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-min-width='3']{min-width:75%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-max-width='3']{max-width:75%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-width='4']{width:100%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-x='4']{left:100%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-min-width='4']{min-width:100%}.grid-stack.grid-stack-5>.grid-stack-item,.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='1']{min-width:20%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-max-width='4']{max-width:100%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='1']{width:20%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='1']{left:20%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='1']{max-width:20%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='2']{width:40%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='2']{left:40%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='2']{min-width:40%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='2']{max-width:40%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='3']{width:60%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='3']{left:60%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='3']{min-width:60%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='3']{max-width:60%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='4']{width:80%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='4']{left:80%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='4']{min-width:80%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='4']{max-width:80%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='5']{width:100%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='5']{left:100%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='5']{min-width:100%}.grid-stack.grid-stack-6>.grid-stack-item,.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='1']{min-width:16.6666666667%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='5']{max-width:100%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='1']{width:16.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='1']{left:16.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='1']{max-width:16.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='2']{width:33.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='2']{left:33.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='2']{min-width:33.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='2']{max-width:33.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='3']{width:50%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='3']{left:50%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='3']{min-width:50%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='3']{max-width:50%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='4']{width:66.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='4']{left:66.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='4']{min-width:66.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='4']{max-width:66.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='5']{width:83.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='5']{left:83.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='5']{min-width:83.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='5']{max-width:83.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='6']{width:100%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='6']{left:100%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='6']{min-width:100%}.grid-stack.grid-stack-7>.grid-stack-item,.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='1']{min-width:14.2857142857%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='6']{max-width:100%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='1']{width:14.2857142857%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='1']{left:14.2857142857%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='1']{max-width:14.2857142857%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='2']{width:28.5714285714%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='2']{left:28.5714285714%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='2']{min-width:28.5714285714%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='2']{max-width:28.5714285714%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='3']{width:42.8571428571%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='3']{left:42.8571428571%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='3']{min-width:42.8571428571%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='3']{max-width:42.8571428571%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='4']{width:57.1428571429%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='4']{left:57.1428571429%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='4']{min-width:57.1428571429%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='4']{max-width:57.1428571429%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='5']{width:71.4285714286%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='5']{left:71.4285714286%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='5']{min-width:71.4285714286%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='5']{max-width:71.4285714286%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='6']{width:85.7142857143%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='6']{left:85.7142857143%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='6']{min-width:85.7142857143%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='6']{max-width:85.7142857143%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='7']{width:100%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='7']{left:100%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='7']{min-width:100%}.grid-stack.grid-stack-8>.grid-stack-item,.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='1']{min-width:12.5%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='7']{max-width:100%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='1']{width:12.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='1']{left:12.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='1']{max-width:12.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='2']{width:25%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='2']{left:25%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='2']{min-width:25%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='2']{max-width:25%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='3']{width:37.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='3']{left:37.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='3']{min-width:37.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='3']{max-width:37.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='4']{width:50%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='4']{left:50%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='4']{min-width:50%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='4']{max-width:50%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='5']{width:62.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='5']{left:62.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='5']{min-width:62.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='5']{max-width:62.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='6']{width:75%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='6']{left:75%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='6']{min-width:75%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='6']{max-width:75%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='7']{width:87.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='7']{left:87.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='7']{min-width:87.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='7']{max-width:87.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='8']{width:100%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='8']{left:100%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='8']{min-width:100%}.grid-stack.grid-stack-9>.grid-stack-item,.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='1']{min-width:11.1111111111%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='8']{max-width:100%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='1']{width:11.1111111111%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='1']{left:11.1111111111%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='1']{max-width:11.1111111111%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='2']{width:22.2222222222%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='2']{left:22.2222222222%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='2']{min-width:22.2222222222%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='2']{max-width:22.2222222222%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='3']{width:33.3333333333%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='3']{left:33.3333333333%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='3']{min-width:33.3333333333%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='3']{max-width:33.3333333333%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='4']{width:44.4444444444%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='4']{left:44.4444444444%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='4']{min-width:44.4444444444%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='4']{max-width:44.4444444444%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='5']{width:55.5555555556%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='5']{left:55.5555555556%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='5']{min-width:55.5555555556%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='5']{max-width:55.5555555556%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='6']{width:66.6666666667%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='6']{left:66.6666666667%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='6']{min-width:66.6666666667%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='6']{max-width:66.6666666667%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='7']{width:77.7777777778%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='7']{left:77.7777777778%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='7']{min-width:77.7777777778%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='7']{max-width:77.7777777778%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='8']{width:88.8888888889%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='8']{left:88.8888888889%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='8']{min-width:88.8888888889%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='8']{max-width:88.8888888889%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='9']{width:100%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='9']{left:100%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='9']{min-width:100%}.grid-stack.grid-stack-10>.grid-stack-item,.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='1']{min-width:10%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='9']{max-width:100%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='1']{width:10%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='1']{left:10%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='1']{max-width:10%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='2']{width:20%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='2']{left:20%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='2']{min-width:20%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='2']{max-width:20%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='3']{width:30%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='3']{left:30%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='3']{min-width:30%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='3']{max-width:30%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='4']{width:40%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='4']{left:40%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='4']{min-width:40%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='4']{max-width:40%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='5']{width:50%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='5']{left:50%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='5']{min-width:50%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='5']{max-width:50%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='6']{width:60%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='6']{left:60%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='6']{min-width:60%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='6']{max-width:60%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='7']{width:70%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='7']{left:70%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='7']{min-width:70%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='7']{max-width:70%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='8']{width:80%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='8']{left:80%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='8']{min-width:80%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='8']{max-width:80%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='9']{width:90%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='9']{left:90%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='9']{min-width:90%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='9']{max-width:90%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='10']{width:100%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='10']{left:100%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='10']{min-width:100%}.grid-stack.grid-stack-11>.grid-stack-item,.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='1']{min-width:9.0909090909%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='10']{max-width:100%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='1']{width:9.0909090909%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='1']{left:9.0909090909%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='1']{max-width:9.0909090909%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='2']{width:18.1818181818%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='2']{left:18.1818181818%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='2']{min-width:18.1818181818%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='2']{max-width:18.1818181818%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='3']{width:27.2727272727%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='3']{left:27.2727272727%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='3']{min-width:27.2727272727%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='3']{max-width:27.2727272727%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='4']{width:36.3636363636%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='4']{left:36.3636363636%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='4']{min-width:36.3636363636%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='4']{max-width:36.3636363636%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='5']{width:45.4545454545%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='5']{left:45.4545454545%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='5']{min-width:45.4545454545%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='5']{max-width:45.4545454545%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='6']{width:54.5454545455%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='6']{left:54.5454545455%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='6']{min-width:54.5454545455%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='6']{max-width:54.5454545455%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='7']{width:63.6363636364%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='7']{left:63.6363636364%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='7']{min-width:63.6363636364%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='7']{max-width:63.6363636364%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='8']{width:72.7272727273%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='8']{left:72.7272727273%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='8']{min-width:72.7272727273%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='8']{max-width:72.7272727273%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='9']{width:81.8181818182%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='9']{left:81.8181818182%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='9']{min-width:81.8181818182%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='9']{max-width:81.8181818182%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='10']{width:90.9090909091%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='10']{left:90.9090909091%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='10']{min-width:90.9090909091%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='10']{max-width:90.9090909091%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='11']{width:100%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='11']{left:100%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='11']{min-width:100%}.grid-stack.grid-stack-12>.grid-stack-item,.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='1']{min-width:8.3333333333%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='11']{max-width:100%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='1']{width:8.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='1']{left:8.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='1']{max-width:8.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='2']{width:16.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='2']{left:16.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='2']{min-width:16.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='2']{max-width:16.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='3']{width:25%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='3']{left:25%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='3']{min-width:25%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='3']{max-width:25%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='4']{width:33.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='4']{left:33.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='4']{min-width:33.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='4']{max-width:33.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='5']{width:41.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='5']{left:41.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='5']{min-width:41.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='5']{max-width:41.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='6']{width:50%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='6']{left:50%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='6']{min-width:50%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='6']{max-width:50%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='7']{width:58.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='7']{left:58.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='7']{min-width:58.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='7']{max-width:58.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='8']{width:66.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='8']{left:66.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='8']{min-width:66.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='8']{max-width:66.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='9']{width:75%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='9']{left:75%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='9']{min-width:75%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='9']{max-width:75%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='10']{width:83.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='10']{left:83.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='10']{min-width:83.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='10']{max-width:83.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='11']{width:91.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='11']{left:91.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='11']{min-width:91.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='11']{max-width:91.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='12']{width:100%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='12']{left:100%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='12']{min-width:100%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='12']{max-width:100%} \ No newline at end of file +.grid-stack.grid-stack-1>.grid-stack-item{min-width:100%}.grid-stack.grid-stack-1>.grid-stack-item[data-gs-width='1']{width:100%}.grid-stack.grid-stack-1>.grid-stack-item[data-gs-x='1']{left:100%}.grid-stack.grid-stack-1>.grid-stack-item[data-gs-min-width='1']{min-width:100%}.grid-stack.grid-stack-1>.grid-stack-item[data-gs-max-width='1']{max-width:100%}.grid-stack.grid-stack-2>.grid-stack-item{min-width:50%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-width='1']{width:50%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-x='1']{left:50%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-min-width='1']{min-width:50%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-max-width='1']{max-width:50%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-width='2']{width:100%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-x='2']{left:100%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-min-width='2']{min-width:100%}.grid-stack.grid-stack-2>.grid-stack-item[data-gs-max-width='2']{max-width:100%}.grid-stack.grid-stack-3>.grid-stack-item{min-width:33.3333333333%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-width='1']{width:33.3333333333%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-x='1']{left:33.3333333333%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-min-width='1']{min-width:33.3333333333%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-max-width='1']{max-width:33.3333333333%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-width='2']{width:66.6666666667%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-x='2']{left:66.6666666667%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-min-width='2']{min-width:66.6666666667%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-max-width='2']{max-width:66.6666666667%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-width='3']{width:100%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-x='3']{left:100%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-min-width='3']{min-width:100%}.grid-stack.grid-stack-3>.grid-stack-item[data-gs-max-width='3']{max-width:100%}.grid-stack.grid-stack-4>.grid-stack-item{min-width:25%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-width='1']{width:25%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-x='1']{left:25%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-min-width='1']{min-width:25%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-max-width='1']{max-width:25%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-width='2']{width:50%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-x='2']{left:50%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-min-width='2']{min-width:50%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-max-width='2']{max-width:50%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-width='3']{width:75%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-x='3']{left:75%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-min-width='3']{min-width:75%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-max-width='3']{max-width:75%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-width='4']{width:100%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-x='4']{left:100%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-min-width='4']{min-width:100%}.grid-stack.grid-stack-4>.grid-stack-item[data-gs-max-width='4']{max-width:100%}.grid-stack.grid-stack-5>.grid-stack-item{min-width:20%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='1']{width:20%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='1']{left:20%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='1']{min-width:20%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='1']{max-width:20%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='2']{width:40%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='2']{left:40%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='2']{min-width:40%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='2']{max-width:40%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='3']{width:60%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='3']{left:60%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='3']{min-width:60%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='3']{max-width:60%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='4']{width:80%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='4']{left:80%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='4']{min-width:80%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='4']{max-width:80%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-width='5']{width:100%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-x='5']{left:100%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-min-width='5']{min-width:100%}.grid-stack.grid-stack-5>.grid-stack-item[data-gs-max-width='5']{max-width:100%}.grid-stack.grid-stack-6>.grid-stack-item{min-width:16.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='1']{width:16.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='1']{left:16.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='1']{min-width:16.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='1']{max-width:16.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='2']{width:33.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='2']{left:33.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='2']{min-width:33.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='2']{max-width:33.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='3']{width:50%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='3']{left:50%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='3']{min-width:50%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='3']{max-width:50%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='4']{width:66.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='4']{left:66.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='4']{min-width:66.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='4']{max-width:66.6666666667%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='5']{width:83.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='5']{left:83.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='5']{min-width:83.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='5']{max-width:83.3333333333%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-width='6']{width:100%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-x='6']{left:100%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-min-width='6']{min-width:100%}.grid-stack.grid-stack-6>.grid-stack-item[data-gs-max-width='6']{max-width:100%}.grid-stack.grid-stack-7>.grid-stack-item{min-width:14.2857142857%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='1']{width:14.2857142857%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='1']{left:14.2857142857%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='1']{min-width:14.2857142857%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='1']{max-width:14.2857142857%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='2']{width:28.5714285714%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='2']{left:28.5714285714%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='2']{min-width:28.5714285714%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='2']{max-width:28.5714285714%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='3']{width:42.8571428571%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='3']{left:42.8571428571%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='3']{min-width:42.8571428571%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='3']{max-width:42.8571428571%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='4']{width:57.1428571429%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='4']{left:57.1428571429%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='4']{min-width:57.1428571429%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='4']{max-width:57.1428571429%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='5']{width:71.4285714286%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='5']{left:71.4285714286%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='5']{min-width:71.4285714286%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='5']{max-width:71.4285714286%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='6']{width:85.7142857143%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='6']{left:85.7142857143%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='6']{min-width:85.7142857143%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='6']{max-width:85.7142857143%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-width='7']{width:100%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-x='7']{left:100%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-min-width='7']{min-width:100%}.grid-stack.grid-stack-7>.grid-stack-item[data-gs-max-width='7']{max-width:100%}.grid-stack.grid-stack-8>.grid-stack-item{min-width:12.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='1']{width:12.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='1']{left:12.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='1']{min-width:12.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='1']{max-width:12.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='2']{width:25%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='2']{left:25%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='2']{min-width:25%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='2']{max-width:25%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='3']{width:37.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='3']{left:37.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='3']{min-width:37.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='3']{max-width:37.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='4']{width:50%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='4']{left:50%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='4']{min-width:50%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='4']{max-width:50%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='5']{width:62.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='5']{left:62.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='5']{min-width:62.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='5']{max-width:62.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='6']{width:75%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='6']{left:75%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='6']{min-width:75%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='6']{max-width:75%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='7']{width:87.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='7']{left:87.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='7']{min-width:87.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='7']{max-width:87.5%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-width='8']{width:100%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-x='8']{left:100%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-min-width='8']{min-width:100%}.grid-stack.grid-stack-8>.grid-stack-item[data-gs-max-width='8']{max-width:100%}.grid-stack.grid-stack-9>.grid-stack-item{min-width:11.1111111111%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='1']{width:11.1111111111%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='1']{left:11.1111111111%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='1']{min-width:11.1111111111%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='1']{max-width:11.1111111111%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='2']{width:22.2222222222%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='2']{left:22.2222222222%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='2']{min-width:22.2222222222%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='2']{max-width:22.2222222222%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='3']{width:33.3333333333%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='3']{left:33.3333333333%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='3']{min-width:33.3333333333%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='3']{max-width:33.3333333333%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='4']{width:44.4444444444%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='4']{left:44.4444444444%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='4']{min-width:44.4444444444%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='4']{max-width:44.4444444444%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='5']{width:55.5555555556%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='5']{left:55.5555555556%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='5']{min-width:55.5555555556%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='5']{max-width:55.5555555556%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='6']{width:66.6666666667%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='6']{left:66.6666666667%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='6']{min-width:66.6666666667%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='6']{max-width:66.6666666667%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='7']{width:77.7777777778%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='7']{left:77.7777777778%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='7']{min-width:77.7777777778%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='7']{max-width:77.7777777778%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='8']{width:88.8888888889%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='8']{left:88.8888888889%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='8']{min-width:88.8888888889%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='8']{max-width:88.8888888889%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-width='9']{width:100%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-x='9']{left:100%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-min-width='9']{min-width:100%}.grid-stack.grid-stack-9>.grid-stack-item[data-gs-max-width='9']{max-width:100%}.grid-stack.grid-stack-10>.grid-stack-item{min-width:10%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='1']{width:10%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='1']{left:10%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='1']{min-width:10%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='1']{max-width:10%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='2']{width:20%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='2']{left:20%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='2']{min-width:20%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='2']{max-width:20%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='3']{width:30%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='3']{left:30%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='3']{min-width:30%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='3']{max-width:30%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='4']{width:40%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='4']{left:40%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='4']{min-width:40%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='4']{max-width:40%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='5']{width:50%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='5']{left:50%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='5']{min-width:50%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='5']{max-width:50%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='6']{width:60%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='6']{left:60%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='6']{min-width:60%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='6']{max-width:60%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='7']{width:70%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='7']{left:70%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='7']{min-width:70%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='7']{max-width:70%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='8']{width:80%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='8']{left:80%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='8']{min-width:80%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='8']{max-width:80%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='9']{width:90%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='9']{left:90%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='9']{min-width:90%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='9']{max-width:90%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-width='10']{width:100%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-x='10']{left:100%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-min-width='10']{min-width:100%}.grid-stack.grid-stack-10>.grid-stack-item[data-gs-max-width='10']{max-width:100%}.grid-stack.grid-stack-11>.grid-stack-item{min-width:9.0909090909%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='1']{width:9.0909090909%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='1']{left:9.0909090909%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='1']{min-width:9.0909090909%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='1']{max-width:9.0909090909%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='2']{width:18.1818181818%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='2']{left:18.1818181818%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='2']{min-width:18.1818181818%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='2']{max-width:18.1818181818%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='3']{width:27.2727272727%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='3']{left:27.2727272727%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='3']{min-width:27.2727272727%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='3']{max-width:27.2727272727%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='4']{width:36.3636363636%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='4']{left:36.3636363636%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='4']{min-width:36.3636363636%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='4']{max-width:36.3636363636%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='5']{width:45.4545454545%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='5']{left:45.4545454545%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='5']{min-width:45.4545454545%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='5']{max-width:45.4545454545%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='6']{width:54.5454545455%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='6']{left:54.5454545455%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='6']{min-width:54.5454545455%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='6']{max-width:54.5454545455%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='7']{width:63.6363636364%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='7']{left:63.6363636364%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='7']{min-width:63.6363636364%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='7']{max-width:63.6363636364%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='8']{width:72.7272727273%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='8']{left:72.7272727273%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='8']{min-width:72.7272727273%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='8']{max-width:72.7272727273%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='9']{width:81.8181818182%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='9']{left:81.8181818182%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='9']{min-width:81.8181818182%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='9']{max-width:81.8181818182%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='10']{width:90.9090909091%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='10']{left:90.9090909091%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='10']{min-width:90.9090909091%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='10']{max-width:90.9090909091%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-width='11']{width:100%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-x='11']{left:100%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-min-width='11']{min-width:100%}.grid-stack.grid-stack-11>.grid-stack-item[data-gs-max-width='11']{max-width:100%}.grid-stack.grid-stack-12>.grid-stack-item{min-width:8.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='1']{width:8.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='1']{left:8.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='1']{min-width:8.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='1']{max-width:8.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='2']{width:16.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='2']{left:16.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='2']{min-width:16.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='2']{max-width:16.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='3']{width:25%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='3']{left:25%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='3']{min-width:25%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='3']{max-width:25%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='4']{width:33.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='4']{left:33.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='4']{min-width:33.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='4']{max-width:33.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='5']{width:41.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='5']{left:41.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='5']{min-width:41.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='5']{max-width:41.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='6']{width:50%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='6']{left:50%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='6']{min-width:50%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='6']{max-width:50%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='7']{width:58.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='7']{left:58.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='7']{min-width:58.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='7']{max-width:58.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='8']{width:66.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='8']{left:66.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='8']{min-width:66.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='8']{max-width:66.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='9']{width:75%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='9']{left:75%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='9']{min-width:75%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='9']{max-width:75%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='10']{width:83.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='10']{left:83.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='10']{min-width:83.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='10']{max-width:83.3333333333%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='11']{width:91.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='11']{left:91.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='11']{min-width:91.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='11']{max-width:91.6666666667%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-width='12']{width:100%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-x='12']{left:100%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-min-width='12']{min-width:100%}.grid-stack.grid-stack-12>.grid-stack-item[data-gs-max-width='12']{max-width:100%} \ No newline at end of file diff --git a/dist/gridstack.all.js b/dist/gridstack.all.js index f4b9c2a31..6d7e8d83b 100644 --- a/dist/gridstack.all.js +++ b/dist/gridstack.all.js @@ -1,53 +1,17 @@ /** - * gridstack.js 0.3.0-dev + * gridstack.js 1.0.0-dev * http://troolee.github.io/gridstack.js/ - * (c) 2014-2016 Pavel Reznikov, Dylan Weiss + * (c) 2014-2017 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"],a);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(b){}try{_=require("lodash")}catch(b){}a(jQuery,_)}else a(jQuery,_)}(function(a,b){ -// jscs:enable requireCamelCaseOrUpperCaseIdentifiers -/** - * @class GridStackDragDropPlugin - * Base class for drag'n'drop plugin. - */ -function c(a){this.grid=a}var d=window,e=function(a,b,c){var d=function(){return console.warn("gridstack.js: Function `"+b+"` is deprecated as of v0.2.5 and has been replaced with `"+c+"`. It will be **completely** removed in v1.0."),a.apply(this,arguments)};return d.prototype=a.prototype,d},f=function(a,b){console.warn("gridstack.js: Option `"+a+"` is deprecated as of v0.2.5 and has been replaced with `"+b+"`. It will be **completely** removed in v1.0.")},g={isIntercepted:function(a,b){return!(a.x+a.width<=b.x||b.x+b.width<=a.x||a.y+a.height<=b.y||b.y+b.height<=a.y)},sort:function(a,c,d){return d=d||b.chain(a).map(function(a){return a.x+a.width}).max().value(),c=c!=-1?1:-1,b.sortBy(a,function(a){return c*(a.x+a.y*d)})},createStylesheet:function(a){var b=document.createElement("style");return b.setAttribute("type","text/css"),b.setAttribute("data-gs-style-id",a),b.styleSheet?b.styleSheet.cssText="":b.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(b),b.sheet},removeStylesheet:function(b){a("STYLE[data-gs-style-id="+b+"]").remove()},insertCSSRule:function(a,b,c,d){"function"==typeof a.insertRule?a.insertRule(b+"{"+c+"}",d):"function"==typeof a.addRule&&a.addRule(b,c,d)},toBool:function(a){return"boolean"==typeof a?a:"string"==typeof a?(a=a.toLowerCase(),!(""===a||"no"==a||"false"==a||"0"==a)):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&g.isIntercepted(a,this.nn)},_didCollide:function(a){return g.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return g.isIntercepted({x:this.x,y:this.y,width:this.node.width,height:this.node.height},a)},parseHeight:function(a){var c=a,d="px";if(c&&b.isString(c)){var e=c.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/);if(!e)throw new Error("Invalid height");d=e[2]||"px",c=parseFloat(e[1])}return{height:c,unit:d}}}; -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -g.is_intercepted=e(g.isIntercepted,"is_intercepted","isIntercepted"),g.create_stylesheet=e(g.createStylesheet,"create_stylesheet","createStylesheet"),g.remove_stylesheet=e(g.removeStylesheet,"remove_stylesheet","removeStylesheet"),g.insert_css_rule=e(g.insertCSSRule,"insert_css_rule","insertCSSRule"),c.registeredPlugins=[],c.registerPlugin=function(a){c.registeredPlugins.push(a)},c.prototype.resizable=function(a,b){return this},c.prototype.draggable=function(a,b){return this},c.prototype.droppable=function(a,b){return this},c.prototype.isDroppable=function(a){return!1},c.prototype.on=function(a,b,c){return this};var h=0,i=function(a,b,c,d,e){this.width=a,this["float"]=c||!1,this.height=d||0,this.nodes=e||[],this.onchange=b||function(){},this._updateCounter=0,this._float=this["float"],this._addedNodes=[],this._removedNodes=[]};i.prototype.batchUpdate=function(){this._updateCounter=1,this["float"]=!0},i.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this["float"]=this._float,this._packNodes(),this._notify())}, -// For Meteor support: https://github.com/troolee/gridstack.js/pull/272 -i.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},i.prototype._fixCollisions=function(a,c){this._sortNodes(-1);var d=a,e=Boolean(b.find(this.nodes,function(a){return a.locked}));for(this["float"]||e||(d={x:0,y:a.y,width:this.width,height:a.height});;){var f=b.find(this.nodes,b.bind(g._collisionNodeCheck,{node:a,nn:d}));if("undefined"==typeof f)return; -// will try to fix the collision -var h,i=(a.y+a.height,!c&&a.y+a.height+f.height>this.height);if(i){if( -// if the pos is out of bounds, put it on first available -h=this.findFreeSpace(f.width,f.height,f),h||(h=this.findFreeSpace()),!h)return}else h={x:f.x,y:a.y+a.height,w:f.width,h:f.height};h&&this.moveNode(f,h.x,h.y,h.w,h.h,!0,c)}},i.prototype.whatIsHere=function(a,c,d,e){var f={x:a||0,y:c||0,width:d||1,height:e||1},h=b.filter(this.nodes,b.bind(function(a){return g.isIntercepted(a,f)},this));return h},i.prototype.isAreaEmpty=function(a,b,c,d){var e=this.whatIsHere(a,b,c,d);return 0===e.length},i.prototype.findFreeSpace=function(a,b,c){var d,e,f=null,g=[];for( -// first free for 1x1 or we have specified width and height -a||(a=1),b||(b=1),d=0;d<=this.width-a&&!f;d++)for(e=0;e<=this.height-b&&!f;e++)g=this.whatIsHere(d,e,a,b),(!g.length||c&&1===g.length&&g[0]===c)&&(f={x:d,y:e,w:a,h:b});return f},i.prototype._sortNodes=function(a){this.nodes=g.sort(this.nodes,a,this.width)},i.prototype._packNodes=function(){this._sortNodes(),this["float"]?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&"undefined"!=typeof a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(g._didCollide,{n:a,newY:d})).value();e||(a._dirty=!0,a.y=d),--d}},this)):b.each(this.nodes,b.bind(function(a,c){if(!a.locked)for(;a.y>0;){var d=a.y-1,e=0===c;if(c>0){var f=b.chain(this.nodes).take(c).find(b.bind(g._didCollide,{n:a,newY:d})).value();e="undefined"==typeof f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},i.prototype._prepareNode=function(a,c){return a=b.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),this.height&&a.height>this.height?a.height=this.height:a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(c?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},i.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]="undefined"==typeof a[0]?[]:[a[0]],a[1]="undefined"==typeof a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},i.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},i.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},i.prototype.addNode=function(a,c,d){if(a=this._prepareNode(a),"undefined"!=typeof a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),"undefined"!=typeof a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),"undefined"!=typeof a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++h,a._dirty=!0,a.autoPosition){this._sortNodes();for(var e=0;;++e){var f=e%this.width,i=Math.floor(e/this.width);if(!(f+a.width>this.width||b.find(this.nodes,b.bind(g._isAddNodeIntercepted,{x:f,y:i,node:a})))){a.x=f,a.y=i;break}}}return this.nodes.push(a),"undefined"!=typeof c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a,d),this._packNodes(),this._notify(),a},i.prototype.removeNode=function(a,c){a&&(a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c))},i.prototype.canMoveNode=function(c,d,e,f,g){if(!this.isNodeChangedPosition(c,d,e,f,g))return!1;var h=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!h)return!0;var j,k=new i(this.width,null,this["float"],0,b.map(this.nodes,function(b){return b==c?j=a.extend({},b):a.extend({},b)}));if("undefined"==typeof j)return!0;k.moveNode(j,d,e,f,g,!1,!0);var l=!0; -// always allow moving the one out of bounds -return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=j&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height,c.y+c.height>this.height&&(l=!0)),l},i.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new i(this.width,null,this["float"],0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c,!1,!0),d.getGridHeight()<=this.height},i.prototype.isNodeChangedPosition=function(a,b,c,d,e){return"number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},i.prototype.moveNode=function(a,b,c,d,e,f,g){if(!this.isNodeChangedPosition(a,b,c,d,e))return a;if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;var h=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a.lastTriedX=b,a.lastTriedY=c,a.lastTriedWidth=d,a.lastTriedHeight=e,a=this._prepareNode(a,h),this._fixCollisions(a,g),f||(this._packNodes(),this._notify()),a},i.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},i.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},i.prototype.endUpdate=function(){b.each(this.nodes,function(a){a._origY=a.y});var a=b.find(this.nodes,function(a){return a._updating});a&&(a._updating=!1)};var j=function(d,e){var g,h,j=this;e=e||{},this.container=a(d), -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -"undefined"!=typeof e.handle_class&&(e.handleClass=e.handle_class,f("handle_class","handleClass")),"undefined"!=typeof e.item_class&&(e.itemClass=e.item_class,f("item_class","itemClass")),"undefined"!=typeof e.placeholder_class&&(e.placeholderClass=e.placeholder_class,f("placeholder_class","placeholderClass")),"undefined"!=typeof e.placeholder_text&&(e.placeholderText=e.placeholder_text,f("placeholder_text","placeholderText")),"undefined"!=typeof e.cell_height&&(e.cellHeight=e.cell_height,f("cell_height","cellHeight")),"undefined"!=typeof e.vertical_margin&&(e.verticalMargin=e.vertical_margin,f("vertical_margin","verticalMargin")),"undefined"!=typeof e.min_width&&(e.minWidth=e.min_width,f("min_width","minWidth")),"undefined"!=typeof e.static_grid&&(e.staticGrid=e.static_grid,f("static_grid","staticGrid")),"undefined"!=typeof e.is_nested&&(e.isNested=e.is_nested,f("is_nested","isNested")),"undefined"!=typeof e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,f("always_show_resize_handle","alwaysShowResizeHandle")), -// jscs:enable requireCamelCaseOrUpperCaseIdentifiers -e.itemClass=e.itemClass||"grid-stack-item";var k=this.container.closest("."+e.itemClass).length>0;if(this.opts=b.defaults(e||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,"float":!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:e.alwaysShowResizeHandle||!1,resizable:b.defaults(e.resizable||{},{autoHide:!e.alwaysShowResizeHandle,handles:"se"}),draggable:b.defaults(e.draggable||{},{handle:(e.handleClass?"."+e.handleClass:e.handle?e.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:e.disableDrag||!1,disableResize:e.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px",oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),this.opts.ddPlugin===!1?this.opts.ddPlugin=c:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.first(c.registeredPlugins)||c),this.dd=new this.opts.ddPlugin(this),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=k,h="auto"===this.opts.cellHeight,h?j.cellHeight(j.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),k&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new i(this.opts.width,function(a,c){c="undefined"==typeof c||c;var d=0;b.each(a,function(a){c&&null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),d=Math.max(d,a.y+a.height))}),j._updateStyles(j.opts.height||max_height+10)},this.opts["float"],this.opts.height),this.opts.auto){var l=[],m=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),l.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*m.opts.width})}),b.chain(l).sortBy(function(a){return a.i}).each(function(a){j._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(), -// setting styles also for empty grids -this._updateStyles(),this._updateHeightsOnResize=b.throttle(function(){j.cellHeight(j.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&j._updateHeightsOnResize(),j._isOneColumnMode()){if(g)return;j.container.addClass(j.opts.oneColumnModeClass),g=!0,j.grid._sortNodes(),b.each(j.grid.nodes,function(a){j.container.append(a.el),j.opts.staticGrid||((a.noMove||j.opts.disableDrag)&&j.dd.draggable(a.el,"disable"),(a.noResize||j.opts.disableResize)&&j.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!g)return;if(j.container.removeClass(j.opts.oneColumnModeClass),g=!1,j.opts.staticGrid)return;b.each(j.grid.nodes,function(a){a.noMove||j.opts.disableDrag||j.dd.draggable(a.el,"enable"),a.noResize||j.opts.disableResize||j.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!j.opts.staticGrid&&"string"==typeof j.opts.removable){var n=a(j.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+j.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===j&&j._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===j&&j._clearRemovingTimeout(d)})}if(!j.opts.staticGrid&&j.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=j.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!j.grid.canMoveNode(d,f,g))return;j.grid.moveNode(d,f,g),j._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,j.grid.cleanNodes(),j.grid.beginUpdate(d),j.grid.addNode(d),j.container.append(j.placeholder),j.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=j.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,j._updateContainerHeight()};this.dd.droppable(j.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==j)&&b.is(j.opts.acceptWidgets===!0?".grid-stack-item":j.opts.acceptWidgets)}}).on(j.container,"dropover",function(b,c){var d=(j.container.offset(),a(c.draggable)),e=j.cellWidth(),f=j.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),i=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=j.grid._prepareNode({width:h,height:i,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(j.container,"dropout",function(b,c){var d=a(c.draggable);d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,j.grid.removeNode(e),j.placeholder.detach(),j._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}).on(j.container,"drop",function(b,c){j.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=j;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,j.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).addClass(j.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),j.container.append(e),j._prepareElementsByNode(e,d),j._updateContainerHeight(),j._triggerChangeEvent(),j.grid.endUpdate()})}}; -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -// jscs:enable requireCamelCaseOrUpperCaseIdentifiers -return j.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||a===!0)&&this.container.trigger("change",d)},j.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[b.map(this.grid._addedNodes,b.clone)]),this.grid._addedNodes=[])},j.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[b.map(this.grid._removedNodes,b.clone)]),this.grid._removedNodes=[])},j.prototype._initStyles=function(){this._stylesId&&g.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=g.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},j.prototype._updateStyles=function(a){if(null!==this._styles&&"undefined"!=typeof this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if("undefined"==typeof a&&(a=this._styles._max||this.opts.height,this._initStyles(),this._updateContainerHeight()),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&g.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;e=f.grid.width||k<0||f.grid.height&&k>=f.grid.height?(f.opts.removable===!0&&f._setupRemovingTimeout(b),j=c._beforeDragX,k=c._beforeDragY,f.placeholder.detach(),f.placeholder.hide(),f.grid.removeNode(c),f._updateContainerHeight(),c._temporaryRemoved=!0):(f._clearRemovingTimeout(b),c._temporaryRemoved&&(f.grid.addNode(c),f.placeholder.attr("data-gs-x",j).attr("data-gs-y",k).attr("data-gs-width",h).attr("data-gs-height",i).show(),f.container.append(f.placeholder),c.el=f.placeholder,c._temporaryRemoved=!1));else if("resize"==a.type&&j<0)return; -// width and height are undefined if not resizing -var l="undefined"!=typeof h?h:c.lastTriedWidth,m="undefined"!=typeof i?i:c.lastTriedHeight;!f.grid.canMoveNode(c,j,k,h,i)||c.lastTriedX===j&&c.lastTriedY===k&&c.lastTriedWidth===l&&c.lastTriedHeight===m||(c.lastTriedX=j,c.lastTriedY=k,c.lastTriedWidth=h,c.lastTriedHeight=i,f.grid.moveNode(c,j,k,h,i),f._updateContainerHeight())},h=function(g,h){if(f.opts.draggable.handle&&"dragstart"===g.type&&!a(g.originalEvent.target).closest(f.opts.draggable.handle).length)return!1;f.container.append(f.placeholder);var i=a(this);f.grid.cleanNodes(),f.grid.beginUpdate(c),d=f.cellWidth();var j=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));e=f.container.height()/parseInt(f.container.attr("data-gs-current-height")),f.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),c.el=f.placeholder,c._beforeDragX=c.x,c._beforeDragY=c.y,f.dd.resizable(b,"option","minWidth",d*(c.minWidth||1)),f.dd.resizable(b,"option","minHeight",j*(c.minHeight||1)),"resizestart"==g.type&&i.find(".grid-stack-item").trigger("resizestart")},i=function(d,e){var g=a(this);if(g.data("_gridstack_node")){var h=!1;f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove?(h=!0,b.removeData("_gridstack_node"),b.remove()):(f._clearRemovingTimeout(b),c._temporaryRemoved?(g.attr("data-gs-x",c._beforeDragX).attr("data-gs-y",c._beforeDragY).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style"),c.x=c._beforeDragX,c.y=c._beforeDragY,f.grid.addNode(c)):g.attr("data-gs-x",c.x).attr("data-gs-y",c.y).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style")),f._updateContainerHeight(),f._triggerChangeEvent(h),f.grid.endUpdate();var i=g.find(".grid-stack");i.length&&"resizestop"==d.type&&(i.each(function(b,c){a(c).data("gridstack").onResizeHandler()}),g.find(".grid-stack-item").trigger("resizestop"))}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)}},j.prototype._prepareElement=function(b,c){c="undefined"!=typeof c&&c;var d=this;b=a(b),b.addClass(this.opts.itemClass);var e=d.grid.addNode({x:b.attr("data-gs-x"),y:b.attr("data-gs-y"),width:b.attr("data-gs-width"),height:b.attr("data-gs-height"),maxWidth:b.attr("data-gs-max-width"),minWidth:b.attr("data-gs-min-width"),maxHeight:b.attr("data-gs-max-height"),minHeight:b.attr("data-gs-min-height"),autoPosition:g.toBool(b.attr("data-gs-auto-position")),noResize:g.toBool(b.attr("data-gs-no-resize")),noMove:g.toBool(b.attr("data-gs-no-move")),locked:g.toBool(b.attr("data-gs-locked")),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},j.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},j.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),"undefined"!=typeof c&&b.attr("data-gs-x",c),"undefined"!=typeof d&&b.attr("data-gs-y",d),"undefined"!=typeof e&&b.attr("data-gs-width",e),"undefined"!=typeof f&&b.attr("data-gs-height",f),"undefined"!=typeof g&&b.attr("data-gs-auto-position",g?"yes":null),"undefined"!=typeof h&&b.attr("data-gs-min-width",h),"undefined"!=typeof i&&b.attr("data-gs-max-width",i),"undefined"!=typeof j&&b.attr("data-gs-min-height",j),"undefined"!=typeof k&&b.attr("data-gs-max-height",k),"undefined"!=typeof l&&b.attr("data-gs-id",l),this.container.append(b),this.makeWidget(b),b},j.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},j.prototype.willItFit=function(a,b,c,d,e){var f={x:a,y:b,width:c,height:d,autoPosition:e};return this.grid.canBePlacedWithRespectToHeight(f)},j.prototype.removeWidget=function(b,c){c="undefined"==typeof c||c,b=a(b);var d=b.data("_gridstack_node"); -// For Meteor support: https://github.com/troolee/gridstack.js/pull/272 -d||(d=this.grid.getNodeDataByDOMEl(b)),this.grid.removeNode(d,c),b.removeData("_gridstack_node"),this._updateContainerHeight(),c&&b.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},j.prototype.removeAll=function(a){b.each(this.grid.nodes,b.bind(function(b){this.removeWidget(b.el,a)},this)),this.grid.nodes=[],this._updateContainerHeight()},j.prototype.destroy=function(b){a(window).off("resize",this.onResizeHandler),this.disable(),"undefined"==typeof b||b?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),g.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},j.prototype.resizable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");"undefined"==typeof f||null===f||"undefined"==typeof a.ui||d.opts.staticGrid||(f.noResize=!c,f.noResize||d._isOneColumnMode()?d.dd.resizable(e,"disable"):d.dd.resizable(e,"enable"))}),this},j.prototype.movable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");"undefined"==typeof f||null===f||"undefined"==typeof a.ui||d.opts.staticGrid||(f.noMove=!c,f.noMove||d._isOneColumnMode()?(d.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(d.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},j.prototype.enableMove=function(a,b){this.movable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableDrag=!a)},j.prototype.enableResize=function(a,b){this.resizable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableResize=!a)},j.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},j.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},j.prototype.locked=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(e.locked=c||!1,d.attr("data-gs-locked",e.locked?"yes":null))}),this},j.prototype.maxHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.maxHeight=c||!1,d.attr("data-gs-max-height",c)))}),this},j.prototype.minHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.minHeight=c||!1,d.attr("data-gs-min-height",c)))}),this},j.prototype.maxWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.maxWidth=c||!1,d.attr("data-gs-max-width",c)))}),this},j.prototype.minWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.minWidth=c||!1,d.attr("data-gs-min-width",c)))}),this},j.prototype._updateElement=function(b,c){b=a(b).first();var d=b.data("_gridstack_node");if("undefined"!=typeof d&&null!==d){var e=this;e.grid.cleanNodes(),e.grid.beginUpdate(d),c.call(this,b,d),e._updateContainerHeight(),e._triggerChangeEvent(),e.grid.endUpdate()}},j.prototype.resize=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&"undefined"!=typeof b?b:d.width,c=null!==c&&"undefined"!=typeof c?c:d.height,this.grid.moveNode(d,d.x,d.y,b,c)})},j.prototype.move=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&"undefined"!=typeof b?b:d.x,c=null!==c&&"undefined"!=typeof c?c:d.y,this.grid.moveNode(d,b,c,d.width,d.height)})},j.prototype.update=function(a,b,c,d,e){this._updateElement(a,function(a,f){b=null!==b&&"undefined"!=typeof b?b:f.x,c=null!==c&&"undefined"!=typeof c?c:f.y,d=null!==d&&"undefined"!=typeof d?d:f.width,e=null!==e&&"undefined"!=typeof e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},j.prototype.verticalMargin=function(a,b){if("undefined"==typeof a)return this.opts.verticalMargin;var c=g.parseHeight(a);this.opts.verticalMarginUnit===c.unit&&this.opts.height===c.height||(this.opts.verticalMarginUnit=c.unit,this.opts.verticalMargin=c.height,b||this._updateStyles())},j.prototype.cellHeight=function(a,b){if("undefined"==typeof a){if(this.opts.cellHeight)return this.opts.cellHeight;var c=this.container.children("."+this.opts.itemClass).first();return Math.ceil(c.outerHeight()/c.attr("data-gs-height"))}var d=g.parseHeight(a);this.opts.cellHeightUnit===d.heightUnit&&this.opts.height===d.height||(this.opts.cellHeightUnit=d.unit,this.opts.cellHeight=d.height,b||this._updateStyles())},j.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},j.prototype.getCellFromPixel=function(a,b){var c="undefined"!=typeof b&&b?this.container.offset():this.container.position(),d=a.left-c.left,e=a.top-c.top,f=Math.floor(this.container.width()/this.opts.width),g=Math.floor(this.container.height()/parseInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(d/f),y:Math.floor(e/g)}},j.prototype.batchUpdate=function(){this.grid.batchUpdate()},j.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},j.prototype.isAreaEmpty=function(a,b,c,d){return this.grid.isAreaEmpty(a,b,c,d)},j.prototype.findFreeSpace=function(a,b){return this.grid.findFreeSpace(a,b)},j.prototype.setStatic=function(a){this.opts.staticGrid=a===!0,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},j.prototype._setStaticClass=function(){var a="grid-stack-static";this.opts.staticGrid===!0?this.container.addClass(a):this.container.removeClass(a)},j.prototype.refreshNodes=function(b){var c=this;this.removeAll(!1),this.container.find("."+this.opts.itemClass).each(function(b,d){a(d).off("dragstart dragstop drag resizestart resizestop resize"),c.makeWidget(d)}),this.opts.staticGrid&&b||(b?this.disable():this.enable())},j.prototype.getCellFromAbsolutePixel=function(a){var b=this.container.offset(),c=this.container.position(); -// offset relative to gridstack container itself -return a={left:a.left-b.left+c.left,top:a.top-b.top+c.top},this.getCellFromPixel(a)},j.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;dthis.height||a<0||a+c>this.width)return!1;var f=this.whatIsHere(a,b,c,d);return!f.length||e&&1===f.length&&f[0]===e},i.prototype.findFreeSpace=function(a,b,c){var d,e,f=null;for(a||(a=1),b||(b=1),d=0;d<=this.width-a&&!f;d++)for(e=0;e<=this.height-b&&!f;e++)this.isAreaEmpty(d,e,a,b,c)&&(f={x:d,y:e,w:a,h:b});return f},i.prototype._sortNodes=function(a){this.nodes=g.sort(this.nodes,a,this.width)},i.prototype._packNodes=function(){this._sortNodes(),this.float?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&void 0!==a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(g._didCollide,{n:a,newY:d})).value();e||(a._dirty=!0,a.y=d),--d}},this)):b.each(this.nodes,b.bind(function(a,c){if(!a.locked)for(;a.y>0;){var d=a.y-1,e=0===c;if(c>0){var f=b.chain(this.nodes).take(c).find(b.bind(g._didCollide,{n:a,newY:d})).value();e=void 0===f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},i.prototype._prepareNode=function(a,c){return a=b.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),this.height&&a.height>this.height?a.height=this.height:a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(c?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},i.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]=void 0===a[0]?[]:[a[0]],a[1]=void 0===a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},i.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},i.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},i.prototype.addNode=function(a,c){if(a=this._prepareNode(a),void 0!==a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),void 0!==a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),void 0!==a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),void 0!==a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++h,a._dirty=!0,a.autoPosition){this._sortNodes();for(var d=0;;++d){var e=d%this.width,f=Math.floor(d/this.width);if(!(e+a.width>this.width)&&!b.find(this.nodes,b.bind(g._isAddNodeIntercepted,{x:e,y:f,node:a}))){a.x=e,a.y=f;break}}}return this.nodes.push(a),void 0!==c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},i.prototype.removeNode=function(a,c){a&&(a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c))},i.prototype.canMoveNode=function(c,d,e,f,g){if(!this.isNodeChangedPosition(c,d,e,f,g))return!1;var h=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!h)return!0;if(!this.isAreaEmpty(d,e,f,g,c))return!1;var j,k=new i(this.width,null,this.float,0,b.map(this.nodes,function(b){return b==c?j=a.extend({},b):a.extend({},b)}));if(void 0===j)return!0;k.moveNode(j,d,e,f,g);var l=!0;return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=j&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height,c.y+c.height>this.height&&(l=!0)),l},i.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new i(this.width,null,this.float,0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},i.prototype.isNodeChangedPosition=function(a,b,c,d,e){return"number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},i.prototype.moveNode=function(a,b,c,d,e,f){if(!this.isNodeChangedPosition(a,b,c,d,e))return a;if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;if(!this.isAreaEmpty(b,c,d,e,a))return a;var g=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a.lastTriedX=b,a.lastTriedY=c,a.lastTriedWidth=d,a.lastTriedHeight=e,a=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},i.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},i.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},i.prototype.endUpdate=function(){b.each(this.nodes,function(a){a._origY=a.y});var a=b.find(this.nodes,function(a){return a._updating});a&&(a._updating=!1)};var j=function(d,e){var g,h,j=this;e=e||{},this.container=a(d),void 0!==e.handle_class&&(e.handleClass=e.handle_class,f("handle_class","handleClass")),void 0!==e.item_class&&(e.itemClass=e.item_class,f("item_class","itemClass")),void 0!==e.placeholder_class&&(e.placeholderClass=e.placeholder_class,f("placeholder_class","placeholderClass")),void 0!==e.placeholder_text&&(e.placeholderText=e.placeholder_text,f("placeholder_text","placeholderText")),void 0!==e.cell_height&&(e.cellHeight=e.cell_height,f("cell_height","cellHeight")),void 0!==e.vertical_margin&&(e.verticalMargin=e.vertical_margin,f("vertical_margin","verticalMargin")),void 0!==e.min_width&&(e.minWidth=e.min_width,f("min_width","minWidth")),void 0!==e.static_grid&&(e.staticGrid=e.static_grid,f("static_grid","staticGrid")),void 0!==e.is_nested&&(e.isNested=e.is_nested,f("is_nested","isNested")),void 0!==e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,f("always_show_resize_handle","alwaysShowResizeHandle")),e.itemClass=e.itemClass||"grid-stack-item";var k=this.container.closest("."+e.itemClass).length>0;if(this.opts=b.defaults(e||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,float:!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:e.alwaysShowResizeHandle||!1,resizable:b.defaults(e.resizable||{},{autoHide:!e.alwaysShowResizeHandle,handles:"se"}),draggable:b.defaults(e.draggable||{},{handle:(e.handleClass?"."+e.handleClass:e.handle?e.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:e.disableDrag||!1,disableResize:e.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px",disableOneColumnMode:e.disableOneColumnMode||!1,oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),!1===this.opts.ddPlugin?this.opts.ddPlugin=c:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.first(c.registeredPlugins)||c),this.dd=new this.opts.ddPlugin(this),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=k,h="auto"===this.opts.cellHeight,h?j.cellHeight(j.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),k&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new i(this.opts.width,function(a,c){c=void 0===c||c;var d=0;b.each(a,function(a){c&&null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),d=Math.max(d,a.y+a.height))}),j._updateStyles(j.opts.height||max_height+10)},this.opts.float,this.opts.height),this.opts.auto){var l=[],m=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),l.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*m.opts.width})}),b.chain(l).sortBy(function(a){return a.i}).each(function(a){j._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateStyles(),this._updateHeightsOnResize=b.throttle(function(){j.cellHeight(j.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&j._updateHeightsOnResize(),j._isOneColumnMode()&&!j.opts.disableOneColumnMode){if(g)return;j.container.addClass(j.opts.oneColumnModeClass),g=!0,j.grid._sortNodes(),b.each(j.grid.nodes,function(a){j.container.append(a.el),j.opts.staticGrid||(j.dd.draggable(a.el,"disable"),j.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!g)return;if(j.container.removeClass(j.opts.oneColumnModeClass),g=!1,j.opts.staticGrid)return;b.each(j.grid.nodes,function(a){a.noMove||j.opts.disableDrag||j.dd.draggable(a.el,"enable"),a.noResize||j.opts.disableResize||j.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!j.opts.staticGrid&&"string"==typeof j.opts.removable){var n=a(j.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+j.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._clearRemovingTimeout(d)})}if(!j.opts.staticGrid&&j.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=j.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!j.grid.canMoveNode(d,f,g))return;j.grid.moveNode(d,f,g),j._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,j.grid.cleanNodes(),j.grid.beginUpdate(d),j.grid.addNode(d),j.container.append(j.placeholder),j.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=j.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,j._updateContainerHeight()};this.dd.droppable(j.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==j)&&b.is(!0===j.opts.acceptWidgets?".grid-stack-item":j.opts.acceptWidgets)}}).on(j.container,"dropover",function(b,c){var d=(j.container.offset(),a(c.draggable)),e=j.cellWidth(),f=j.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),i=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=j.grid._prepareNode({width:h,height:i,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(j.container,"dropout",function(b,c){var d=a(c.draggable);if(d.data("_gridstack_node")){d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,j.grid.removeNode(e),j.placeholder.detach(),j._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}}).on(j.container,"drop",function(b,c){j.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=j;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d);var f=a(c.draggable).data("_gridstack_node_orig");void 0!==f&&void 0!==f._grid&&f._grid._triggerRemoveEvent(),a(c.helper).remove(),d.el=e,j.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).addClass(j.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),j.container.append(e),j._prepareElementsByNode(e,d),j._updateContainerHeight(),j.grid._addedNodes.push(d),j._triggerAddEvent(),j._triggerChangeEvent(),j.grid.endUpdate(),a(c.draggable).unbind("drag",p),a(c.draggable).removeData("_gridstack_node"),a(c.draggable).removeData("_gridstack_node_orig")})}};return j.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||!0===a)&&this.container.trigger("change",d)},j.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[b.map(this.grid._addedNodes,b.clone)]),this.grid._addedNodes=[])},j.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[b.map(this.grid._removedNodes,b.clone)]),this.grid._removedNodes=[])},j.prototype._initStyles=function(){this._stylesId&&g.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=g.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},j.prototype._updateStyles=function(a){if(null!==this._styles&&void 0!==this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if(void 0===a&&(a=this._styles._max||this.opts.height,this._initStyles(),this._updateContainerHeight()),this._initStyles(),this._updateContainerHeight(),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&g.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;e this.height); - - if (wrongPos) { - // if the pos is out of bounds, put it on first available - newPos = this.findFreeSpace(collisionNode.width, collisionNode.height, collisionNode); - if (!newPos) { - newPos = this.findFreeSpace(); - } - if (!newPos) { - return; // hmm - } - } else { - newPos = { - x: collisionNode.x, - y: node.y + node.height, - w: collisionNode.width, - h: collisionNode.height - }; - } - - if (newPos) { - this.moveNode(collisionNode, newPos.x, newPos.y, newPos.w, newPos.h, true, isClone); - } - + this.moveNode(collisionNode, collisionNode.x, node.y + node.height, + collisionNode.width, collisionNode.height, true); } }; @@ -243,14 +218,17 @@ return collisionNodes; }; - GridStackEngine.prototype.isAreaEmpty = function(x, y, width, height) { - var collisionNodes = this.whatIsHere(x, y, width, height); - return collisionNodes.length === 0; + GridStackEngine.prototype.isAreaEmpty = function(x, y, width, height, exceptNode) { + // first check if is not out of bounds + if (y < 0 || y + height > this.height || x < 0 || x + width > this.width) { + return false; + } + var collisionNodes = this.whatIsHere(x, y, width, height); + return (!collisionNodes.length || (exceptNode && collisionNodes.length === 1 && collisionNodes[0] === exceptNode)); }; GridStackEngine.prototype.findFreeSpace = function(w, h, forNode) { var freeSpace = null, - nodesHere = [], i, j; // first free for 1x1 or we have specified width and height @@ -265,8 +243,7 @@ if (freeSpace) { break; } - nodesHere = this.whatIsHere(i, j, w, h); - if (!nodesHere.length || (forNode && nodesHere.length === 1 && nodesHere[0] === forNode)) { + if (this.isAreaEmpty(i, j, w, h, forNode)) { freeSpace = {x: i, y: j, w: w, h: h}; } } @@ -392,7 +369,7 @@ return _.filter(this.nodes, function(n) { return n._dirty; }); }; - GridStackEngine.prototype.addNode = function(node, triggerAddEvent, isClone) { + GridStackEngine.prototype.addNode = function(node, triggerAddEvent) { node = this._prepareNode(node); if (typeof node.maxWidth != 'undefined') { node.width = Math.min(node.width, node.maxWidth); } @@ -425,7 +402,7 @@ this._addedNodes.push(_.clone(node)); } - this._fixCollisions(node, isClone); + this._fixCollisions(node); this._packNodes(); this._notify(); return node; @@ -451,6 +428,10 @@ return true; } + if (!this.isAreaEmpty(x, y, width, height, node)) { + return false; + } + var clonedNode; var clone = new GridStackEngine( this.width, @@ -469,7 +450,7 @@ return true; } - clone.moveNode(clonedNode, x, y, width, height, false, true); + clone.moveNode(clonedNode, x, y, width, height); var res = true; @@ -501,7 +482,7 @@ this.float, 0, _.map(this.nodes, function(n) { return $.extend({}, n); })); - clone.addNode(node, false, true); + clone.addNode(node); return clone.getGridHeight() <= this.height; }; @@ -522,7 +503,7 @@ return true; }; - GridStackEngine.prototype.moveNode = function(node, x, y, width, height, noPack, isClone) { + GridStackEngine.prototype.moveNode = function(node, x, y, width, height, noPack) { if (!this.isNodeChangedPosition(node, x, y, width, height)) { return node; } @@ -540,6 +521,10 @@ return node; } + if (!this.isAreaEmpty(x, y, width, height, node)) { + return node; + } + var resizing = node.width != width; node._dirty = true; @@ -555,7 +540,7 @@ node = this._prepareNode(node, resizing); - this._fixCollisions(node, isClone); + this._fixCollisions(node); if (!noPack) { this._packNodes(); this._notify(); @@ -672,6 +657,7 @@ removeTimeout: 2000, verticalMarginUnit: 'px', cellHeightUnit: 'px', + disableOneColumnMode: opts.disableOneColumnMode || false, oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode', ddPlugin: null }); @@ -768,7 +754,7 @@ self._updateHeightsOnResize(); } - if (self._isOneColumnMode()) { + if (self._isOneColumnMode() && !self.opts.disableOneColumnMode) { if (oneColumnMode) { return; } @@ -782,12 +768,8 @@ if (self.opts.staticGrid) { return; } - if (node.noMove || self.opts.disableDrag) { - self.dd.draggable(node.el, 'disable'); - } - if (node.noResize || self.opts.disableResize) { - self.dd.resizable(node.el, 'disable'); - } + self.dd.draggable(node.el, 'disable'); + self.dd.resizable(node.el, 'disable'); node.el.trigger('resize'); }); @@ -916,6 +898,9 @@ }) .on(self.container, 'dropout', function(event, ui) { var el = $(ui.draggable); + if (!el.data('_gridstack_node')) { + return; + } el.unbind('drag', onDrag); var node = el.data('_gridstack_node'); node.el = null; @@ -931,7 +916,11 @@ node._grid = self; var el = $(ui.draggable).clone(false); el.data('_gridstack_node', node); - $(ui.draggable).remove(); + var originalNode = $(ui.draggable).data('_gridstack_node_orig'); + if (typeof originalNode !== 'undefined' && typeof originalNode._grid !== 'undefined') { + originalNode._grid._triggerRemoveEvent(); + } + $(ui.helper).remove(); node.el = el; self.placeholder.hide(); el @@ -948,9 +937,14 @@ self.container.append(el); self._prepareElementsByNode(el, node); self._updateContainerHeight(); + self.grid._addedNodes.push(node); + self._triggerAddEvent(); self._triggerChangeEvent(); self.grid.endUpdate(); + $(ui.draggable).unbind('drag', onDrag); + $(ui.draggable).removeData('_gridstack_node'); + $(ui.draggable).removeData('_gridstack_node_orig'); }); } }; @@ -1009,6 +1003,8 @@ this._initStyles(); this._updateContainerHeight(); } + this._initStyles(); + this._updateContainerHeight(); if (!this.opts.cellHeight) { // The rest will be handled by CSS return ; } @@ -1114,9 +1110,6 @@ }; GridStack.prototype._prepareElementsByNode = function(el, node) { - if (typeof $.ui === 'undefined') { - return; - } var self = this; var cellWidth; @@ -1134,20 +1127,32 @@ } if (event.type == 'drag') { - if (x < 0 || x >= self.grid.width || y < 0 || (self.grid.height && y >= self.grid.height)) { - if (self.opts.removable === true) { - self._setupRemovingTimeout(el); + var cannotPutHere = !self.isAreaEmpty(x, y, node.width, node.height, node), + whatIsHere; + + if (cannotPutHere) { + whatIsHere = self.grid.whatIsHere(x, y, node.width, node.height); + if (whatIsHere && whatIsHere.length === 1 && whatIsHere[0].el === this.placeholder) { + cannotPutHere = false; } + } - x = node._beforeDragX; - y = node._beforeDragY; + if (cannotPutHere) { + if (!node._temporaryRemoved) { + if (self.opts.removable === true) { + self._setupRemovingTimeout(el); + } - self.placeholder.detach(); - self.placeholder.hide(); - self.grid.removeNode(node); - self._updateContainerHeight(); + x = node._beforeDragX; + y = node._beforeDragY; + + self.placeholder.detach(); + self.placeholder.hide(); + self.grid.removeNode(node); + self._updateContainerHeight(); - node._temporaryRemoved = true; + node._temporaryRemoved = true; + } } else { self._clearRemovingTimeout(el); @@ -1217,6 +1222,10 @@ if (event.type == 'resizestart') { o.find('.grid-stack-item').trigger('resizestart'); } + + if (typeof self.opts.draggable.start === 'function') { + self.opts.draggable.start(event, ui); + } }; var onEndMoving = function(event, ui) { @@ -1232,6 +1241,8 @@ if (node._isAboutToRemove) { forceNotify = true; + var gridToNotify = el.data('_gridstack_node')._grid; + gridToNotify._triggerRemoveEvent(); el.removeData('_gridstack_node'); el.remove(); } else { @@ -1266,6 +1277,10 @@ $(el).data('gridstack').onResizeHandler(); }); o.find('.grid-stack-item').trigger('resizestop'); + o.find('.grid-stack-item').trigger('gsresizestop'); + } + if (event.type == 'resizestop') { + self.container.trigger('gsresizestop', o); } }; @@ -1281,11 +1296,11 @@ resize: dragOrResize }); - if (node.noMove || this._isOneColumnMode() || this.opts.disableDrag) { + if (node.noMove || (this._isOneColumnMode() && !self.opts.disableOneColumnMode) || this.opts.disableDrag) { this.dd.draggable(el, 'disable'); } - if (node.noResize || this._isOneColumnMode() || this.opts.disableResize) { + if (node.noResize || (this._isOneColumnMode() && !self.opts.disableOneColumnMode) || this.opts.disableResize) { this.dd.resizable(el, 'disable'); } @@ -1298,11 +1313,12 @@ el = $(el); el.addClass(this.opts.itemClass); - var node = self.grid.addNode({ - x: el.attr('data-gs-x'), - y: el.attr('data-gs-y'), - width: el.attr('data-gs-width'), - height: el.attr('data-gs-height'), + + var props = { + x: parseInt(el.attr('data-gs-x'), 10), + y: parseInt(el.attr('data-gs-y'), 10), + width: parseInt(el.attr('data-gs-width'), 10), + height: parseInt(el.attr('data-gs-height'), 10), maxWidth: el.attr('data-gs-max-width'), minWidth: el.attr('data-gs-min-width'), maxHeight: el.attr('data-gs-max-height'), @@ -1311,10 +1327,28 @@ noResize: Utils.toBool(el.attr('data-gs-no-resize')), noMove: Utils.toBool(el.attr('data-gs-no-move')), locked: Utils.toBool(el.attr('data-gs-locked')), + resizeHandles: el.attr('data-gs-resize-handles'), el: el, id: el.attr('data-gs-id'), _grid: self - }, triggerAddEvent); + }; + + if (!this.isAreaEmpty(props.x, props.y, props.width, props.height)) { + var freeSpace = this.findFreeSpace(props.width, props.height); + if (!freeSpace) { + freeSpace = this.findFreeSpace(1, 1); + } + if (freeSpace) { + props.x = freeSpace.x; + props.y = freeSpace.y; + props.width = freeSpace.w; + props.height = freeSpace.h; + } else { + return; + } + } + + var node = self.grid.addNode(props, triggerAddEvent); el.data('_gridstack_node', node); this._prepareElementsByNode(el, node); @@ -1417,7 +1451,7 @@ } node.noResize = !(val || false); - if (node.noResize || self._isOneColumnMode()) { + if (node.noResize || (self._isOneColumnMode() && !self.opts.disableOneColumnMode)) { self.dd.resizable(el, 'disable'); } else { self.dd.resizable(el, 'enable'); @@ -1438,7 +1472,7 @@ } node.noMove = !(val || false); - if (node.noMove || self._isOneColumnMode()) { + if (node.noMove || (self._isOneColumnMode() && !self.opts.disableOneColumnMode)) { self.dd.draggable(el, 'disable'); el.removeClass('ui-draggable-handle'); } else { @@ -1673,8 +1707,8 @@ this._updateContainerHeight(); }; - GridStack.prototype.isAreaEmpty = function(x, y, width, height) { - return this.grid.isAreaEmpty(x, y, width, height); + GridStack.prototype.isAreaEmpty = function(x, y, width, height, exceptNode) { + return this.grid.isAreaEmpty(x, y, width, height, exceptNode); }; GridStack.prototype.findFreeSpace = function(w, h) { diff --git a/dist/gridstack.min.css b/dist/gridstack.min.css index 7a66c58ad..79ada45df 100644 --- a/dist/gridstack.min.css +++ b/dist/gridstack.min.css @@ -1 +1 @@ -:root .grid-stack-item>.ui-resizable-handle{filter:none}.grid-stack{position:relative}.grid-stack.grid-stack-rtl{direction:ltr}.grid-stack.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack .grid-stack-placeholder>.placeholder-content{border:1px dashed #d3d3d3;margin:0;position:absolute;top:0;left:10px;right:10px;bottom:0;width:auto;z-index:0!important;text-align:center}.grid-stack>.grid-stack-item{min-width:8.3333333333%;position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;top:0;left:10px;right:10px;bottom:0;width:auto;z-index:0!important;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack>.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack>.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack>.grid-stack-item.ui-draggable-dragging,.grid-stack>.grid-stack-item.ui-resizable-resizing{z-index:100}.grid-stack>.grid-stack-item.ui-draggable-dragging>.grid-stack-item-content,.grid-stack>.grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px rgba(0,0,0,.2);opacity:.8}.grid-stack>.grid-stack-item>.ui-resizable-se,.grid-stack>.grid-stack-item>.ui-resizable-sw{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);background-repeat:no-repeat;background-position:center;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.grid-stack>.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;left:10px;top:0}.grid-stack>.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack>.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;right:10px;top:0}.grid-stack>.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;right:10px;top:15px;bottom:15px}.grid-stack>.grid-stack-item>.ui-resizable-se{-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg);cursor:se-resize;width:20px;height:20px;right:10px;bottom:0}.grid-stack>.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack>.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;left:10px;bottom:0}.grid-stack>.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;left:10px;top:15px;bottom:15px}.grid-stack>.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack>.grid-stack-item[data-gs-width='1']{width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='1']{left:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='1']{min-width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='1']{max-width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='2']{width:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='2']{left:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='2']{min-width:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='2']{max-width:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='3']{width:25%}.grid-stack>.grid-stack-item[data-gs-x='3']{left:25%}.grid-stack>.grid-stack-item[data-gs-min-width='3']{min-width:25%}.grid-stack>.grid-stack-item[data-gs-max-width='3']{max-width:25%}.grid-stack>.grid-stack-item[data-gs-width='4']{width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='4']{left:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='4']{min-width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='4']{max-width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='5']{width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='5']{left:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='5']{min-width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='5']{max-width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='6']{width:50%}.grid-stack>.grid-stack-item[data-gs-x='6']{left:50%}.grid-stack>.grid-stack-item[data-gs-min-width='6']{min-width:50%}.grid-stack>.grid-stack-item[data-gs-max-width='6']{max-width:50%}.grid-stack>.grid-stack-item[data-gs-width='7']{width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='7']{left:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='7']{min-width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='7']{max-width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='8']{width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='8']{left:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='8']{min-width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='8']{max-width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='9']{width:75%}.grid-stack>.grid-stack-item[data-gs-x='9']{left:75%}.grid-stack>.grid-stack-item[data-gs-min-width='9']{min-width:75%}.grid-stack>.grid-stack-item[data-gs-max-width='9']{max-width:75%}.grid-stack>.grid-stack-item[data-gs-width='10']{width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='10']{left:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='10']{min-width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='10']{max-width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='11']{width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='11']{left:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='11']{min-width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='11']{max-width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='12']{width:100%}.grid-stack>.grid-stack-item[data-gs-x='12']{left:100%}.grid-stack>.grid-stack-item[data-gs-min-width='12']{min-width:100%}.grid-stack>.grid-stack-item[data-gs-max-width='12']{max-width:100%}.grid-stack.grid-stack-animate,.grid-stack.grid-stack-animate .grid-stack-item{-webkit-transition:left .3s,top .3s,height .3s,width .3s;-moz-transition:left .3s,top .3s,height .3s,width .3s;-ms-transition:left .3s,top .3s,height .3s,width .3s;-o-transition:left .3s,top .3s,height .3s,width .3s;transition:left .3s,top .3s,height .3s,width .3s}.grid-stack.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack.grid-stack-animate .grid-stack-item.ui-resizable-resizing{-webkit-transition:left 0s,top 0s,height 0s,width 0s;-moz-transition:left 0s,top 0s,height 0s,width 0s;-ms-transition:left 0s,top 0s,height 0s,width 0s;-o-transition:left 0s,top 0s,height 0s,width 0s;transition:left 0s,top 0s,height 0s,width 0s}.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} \ No newline at end of file +:root .grid-stack-item>.ui-resizable-handle{filter:none}.grid-stack{position:relative}.grid-stack.grid-stack-rtl{direction:ltr}.grid-stack.grid-stack-rtl>.grid-stack-item{direction:rtl}.grid-stack .grid-stack-placeholder>.placeholder-content{border:1px dashed #d3d3d3;margin:0;position:absolute;top:0;left:10px;right:10px;bottom:0;width:auto;z-index:0!important;text-align:center}.grid-stack>.grid-stack-item{min-width:8.3333333333%;position:absolute;padding:0}.grid-stack>.grid-stack-item>.grid-stack-item-content{margin:0;position:absolute;top:0;left:10px;right:10px;bottom:0;width:auto;z-index:0!important;overflow-x:hidden;overflow-y:auto}.grid-stack>.grid-stack-item>.ui-resizable-handle{position:absolute;font-size:.1px;display:block;-ms-touch-action:none;touch-action:none}.grid-stack>.grid-stack-item.ui-resizable-autohide>.ui-resizable-handle,.grid-stack>.grid-stack-item.ui-resizable-disabled>.ui-resizable-handle{display:none}.grid-stack>.grid-stack-item.ui-draggable-dragging,.grid-stack>.grid-stack-item.ui-resizable-resizing{z-index:100}.grid-stack>.grid-stack-item.ui-draggable-dragging>.grid-stack-item-content,.grid-stack>.grid-stack-item.ui-resizable-resizing>.grid-stack-item-content{box-shadow:1px 4px 6px rgba(0,0,0,.2);opacity:.8}.grid-stack>.grid-stack-item>.ui-resizable-se,.grid-stack>.grid-stack-item>.ui-resizable-sw{background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMS42MjYgNTExLjYyNyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTExLjYyNiA1MTEuNjI3OyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxnPgoJPHBhdGggZD0iTTMyOC45MDYsNDAxLjk5NGgtMzYuNTUzVjEwOS42MzZoMzYuNTUzYzQuOTQ4LDAsOS4yMzYtMS44MDksMTIuODQ3LTUuNDI2YzMuNjEzLTMuNjE1LDUuNDIxLTcuODk4LDUuNDIxLTEyLjg0NSAgIGMwLTQuOTQ5LTEuODAxLTkuMjMxLTUuNDI4LTEyLjg1MWwtNzMuMDg3LTczLjA5QzI2NS4wNDQsMS44MDksMjYwLjc2LDAsMjU1LjgxMywwYy00Ljk0OCwwLTkuMjI5LDEuODA5LTEyLjg0Nyw1LjQyNCAgIGwtNzMuMDg4LDczLjA5Yy0zLjYxOCwzLjYxOS01LjQyNCw3LjkwMi01LjQyNCwxMi44NTFjMCw0Ljk0NiwxLjgwNyw5LjIyOSw1LjQyNCwxMi44NDVjMy42MTksMy42MTcsNy45MDEsNS40MjYsMTIuODUsNS40MjYgICBoMzYuNTQ1djI5Mi4zNThoLTM2LjU0MmMtNC45NTIsMC05LjIzNSwxLjgwOC0xMi44NSw1LjQyMWMtMy42MTcsMy42MjEtNS40MjQsNy45MDUtNS40MjQsMTIuODU0ICAgYzAsNC45NDUsMS44MDcsOS4yMjcsNS40MjQsMTIuODQ3bDczLjA4OSw3My4wODhjMy42MTcsMy42MTcsNy44OTgsNS40MjQsMTIuODQ3LDUuNDI0YzQuOTUsMCw5LjIzNC0xLjgwNywxMi44NDktNS40MjQgICBsNzMuMDg3LTczLjA4OGMzLjYxMy0zLjYyLDUuNDIxLTcuOTAxLDUuNDIxLTEyLjg0N2MwLTQuOTQ4LTEuODA4LTkuMjMyLTUuNDIxLTEyLjg1NCAgIEMzMzguMTQyLDQwMy44MDIsMzMzLjg1Nyw0MDEuOTk0LDMyOC45MDYsNDAxLjk5NHoiIGZpbGw9IiM2NjY2NjYiLz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);background-repeat:no-repeat;background-position:center;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.grid-stack>.grid-stack-item>.ui-resizable-se{-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}.grid-stack>.grid-stack-item>.ui-resizable-nw{cursor:nw-resize;width:20px;height:20px;left:10px;top:0}.grid-stack>.grid-stack-item>.ui-resizable-n{cursor:n-resize;height:10px;top:0;left:25px;right:25px}.grid-stack>.grid-stack-item>.ui-resizable-ne{cursor:ne-resize;width:20px;height:20px;right:10px;top:0}.grid-stack>.grid-stack-item>.ui-resizable-e{cursor:e-resize;width:10px;right:10px;top:15px;bottom:15px}.grid-stack>.grid-stack-item>.ui-resizable-se{cursor:se-resize;width:20px;height:20px;right:10px;bottom:0}.grid-stack>.grid-stack-item>.ui-resizable-s{cursor:s-resize;height:10px;left:25px;bottom:0;right:25px}.grid-stack>.grid-stack-item>.ui-resizable-sw{cursor:sw-resize;width:20px;height:20px;left:10px;bottom:0}.grid-stack>.grid-stack-item>.ui-resizable-w{cursor:w-resize;width:10px;left:10px;top:15px;bottom:15px}.grid-stack>.grid-stack-item.ui-draggable-dragging>.ui-resizable-handle{display:none!important}.grid-stack>.grid-stack-item[data-gs-width='1']{width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='1']{left:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='1']{min-width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='1']{max-width:8.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='2']{width:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='2']{left:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='2']{min-width:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='2']{max-width:16.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='3']{width:25%}.grid-stack>.grid-stack-item[data-gs-x='3']{left:25%}.grid-stack>.grid-stack-item[data-gs-min-width='3']{min-width:25%}.grid-stack>.grid-stack-item[data-gs-max-width='3']{max-width:25%}.grid-stack>.grid-stack-item[data-gs-width='4']{width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='4']{left:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='4']{min-width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='4']{max-width:33.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='5']{width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='5']{left:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='5']{min-width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='5']{max-width:41.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='6']{width:50%}.grid-stack>.grid-stack-item[data-gs-x='6']{left:50%}.grid-stack>.grid-stack-item[data-gs-min-width='6']{min-width:50%}.grid-stack>.grid-stack-item[data-gs-max-width='6']{max-width:50%}.grid-stack>.grid-stack-item[data-gs-width='7']{width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='7']{left:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='7']{min-width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='7']{max-width:58.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='8']{width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='8']{left:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='8']{min-width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='8']{max-width:66.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='9']{width:75%}.grid-stack>.grid-stack-item[data-gs-x='9']{left:75%}.grid-stack>.grid-stack-item[data-gs-min-width='9']{min-width:75%}.grid-stack>.grid-stack-item[data-gs-max-width='9']{max-width:75%}.grid-stack>.grid-stack-item[data-gs-width='10']{width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-x='10']{left:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-min-width='10']{min-width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-max-width='10']{max-width:83.3333333333%}.grid-stack>.grid-stack-item[data-gs-width='11']{width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-x='11']{left:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-min-width='11']{min-width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-max-width='11']{max-width:91.6666666667%}.grid-stack>.grid-stack-item[data-gs-width='12']{width:100%}.grid-stack>.grid-stack-item[data-gs-x='12']{left:100%}.grid-stack>.grid-stack-item[data-gs-min-width='12']{min-width:100%}.grid-stack>.grid-stack-item[data-gs-max-width='12']{max-width:100%}.grid-stack.grid-stack-animate,.grid-stack.grid-stack-animate .grid-stack-item{-webkit-transition:left .3s,top .3s,height .3s,width .3s;-moz-transition:left .3s,top .3s,height .3s,width .3s;-ms-transition:left .3s,top .3s,height .3s,width .3s;-o-transition:left .3s,top .3s,height .3s,width .3s;transition:left .3s,top .3s,height .3s,width .3s}.grid-stack.grid-stack-animate .grid-stack-item.grid-stack-placeholder,.grid-stack.grid-stack-animate .grid-stack-item.ui-draggable-dragging,.grid-stack.grid-stack-animate .grid-stack-item.ui-resizable-resizing{-webkit-transition:left 0s,top 0s,height 0s,width 0s;-moz-transition:left 0s,top 0s,height 0s,width 0s;-ms-transition:left 0s,top 0s,height 0s,width 0s;-o-transition:left 0s,top 0s,height 0s,width 0s;transition:left 0s,top 0s,height 0s,width 0s}.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} \ No newline at end of file diff --git a/dist/gridstack.min.js b/dist/gridstack.min.js index 6e80d84da..e3a0b215b 100644 --- a/dist/gridstack.min.js +++ b/dist/gridstack.min.js @@ -1,42 +1,10 @@ /** - * gridstack.js 0.3.0-dev + * gridstack.js 1.0.0-dev * http://troolee.github.io/gridstack.js/ - * (c) 2014-2016 Pavel Reznikov, Dylan Weiss + * (c) 2014-2017 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"],a);else if("undefined"!=typeof exports){try{jQuery=require("jquery")}catch(b){}try{_=require("lodash")}catch(b){}a(jQuery,_)}else a(jQuery,_)}(function(a,b){ -// jscs:enable requireCamelCaseOrUpperCaseIdentifiers -/** - * @class GridStackDragDropPlugin - * Base class for drag'n'drop plugin. - */ -function c(a){this.grid=a}var d=window,e=function(a,b,c){var d=function(){return console.warn("gridstack.js: Function `"+b+"` is deprecated as of v0.2.5 and has been replaced with `"+c+"`. It will be **completely** removed in v1.0."),a.apply(this,arguments)};return d.prototype=a.prototype,d},f=function(a,b){console.warn("gridstack.js: Option `"+a+"` is deprecated as of v0.2.5 and has been replaced with `"+b+"`. It will be **completely** removed in v1.0.")},g={isIntercepted:function(a,b){return!(a.x+a.width<=b.x||b.x+b.width<=a.x||a.y+a.height<=b.y||b.y+b.height<=a.y)},sort:function(a,c,d){return d=d||b.chain(a).map(function(a){return a.x+a.width}).max().value(),c=c!=-1?1:-1,b.sortBy(a,function(a){return c*(a.x+a.y*d)})},createStylesheet:function(a){var b=document.createElement("style");return b.setAttribute("type","text/css"),b.setAttribute("data-gs-style-id",a),b.styleSheet?b.styleSheet.cssText="":b.appendChild(document.createTextNode("")),document.getElementsByTagName("head")[0].appendChild(b),b.sheet},removeStylesheet:function(b){a("STYLE[data-gs-style-id="+b+"]").remove()},insertCSSRule:function(a,b,c,d){"function"==typeof a.insertRule?a.insertRule(b+"{"+c+"}",d):"function"==typeof a.addRule&&a.addRule(b,c,d)},toBool:function(a){return"boolean"==typeof a?a:"string"==typeof a?(a=a.toLowerCase(),!(""===a||"no"==a||"false"==a||"0"==a)):Boolean(a)},_collisionNodeCheck:function(a){return a!=this.node&&g.isIntercepted(a,this.nn)},_didCollide:function(a){return g.isIntercepted({x:this.n.x,y:this.newY,width:this.n.width,height:this.n.height},a)},_isAddNodeIntercepted:function(a){return g.isIntercepted({x:this.x,y:this.y,width:this.node.width,height:this.node.height},a)},parseHeight:function(a){var c=a,d="px";if(c&&b.isString(c)){var e=c.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw)?$/);if(!e)throw new Error("Invalid height");d=e[2]||"px",c=parseFloat(e[1])}return{height:c,unit:d}}}; -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -g.is_intercepted=e(g.isIntercepted,"is_intercepted","isIntercepted"),g.create_stylesheet=e(g.createStylesheet,"create_stylesheet","createStylesheet"),g.remove_stylesheet=e(g.removeStylesheet,"remove_stylesheet","removeStylesheet"),g.insert_css_rule=e(g.insertCSSRule,"insert_css_rule","insertCSSRule"),c.registeredPlugins=[],c.registerPlugin=function(a){c.registeredPlugins.push(a)},c.prototype.resizable=function(a,b){return this},c.prototype.draggable=function(a,b){return this},c.prototype.droppable=function(a,b){return this},c.prototype.isDroppable=function(a){return!1},c.prototype.on=function(a,b,c){return this};var h=0,i=function(a,b,c,d,e){this.width=a,this["float"]=c||!1,this.height=d||0,this.nodes=e||[],this.onchange=b||function(){},this._updateCounter=0,this._float=this["float"],this._addedNodes=[],this._removedNodes=[]};i.prototype.batchUpdate=function(){this._updateCounter=1,this["float"]=!0},i.prototype.commit=function(){0!==this._updateCounter&&(this._updateCounter=0,this["float"]=this._float,this._packNodes(),this._notify())}, -// For Meteor support: https://github.com/troolee/gridstack.js/pull/272 -i.prototype.getNodeDataByDOMEl=function(a){return b.find(this.nodes,function(b){return a.get(0)===b.el.get(0)})},i.prototype._fixCollisions=function(a,c){this._sortNodes(-1);var d=a,e=Boolean(b.find(this.nodes,function(a){return a.locked}));for(this["float"]||e||(d={x:0,y:a.y,width:this.width,height:a.height});;){var f=b.find(this.nodes,b.bind(g._collisionNodeCheck,{node:a,nn:d}));if("undefined"==typeof f)return; -// will try to fix the collision -var h,i=(a.y+a.height,!c&&a.y+a.height+f.height>this.height);if(i){if( -// if the pos is out of bounds, put it on first available -h=this.findFreeSpace(f.width,f.height,f),h||(h=this.findFreeSpace()),!h)return}else h={x:f.x,y:a.y+a.height,w:f.width,h:f.height};h&&this.moveNode(f,h.x,h.y,h.w,h.h,!0,c)}},i.prototype.whatIsHere=function(a,c,d,e){var f={x:a||0,y:c||0,width:d||1,height:e||1},h=b.filter(this.nodes,b.bind(function(a){return g.isIntercepted(a,f)},this));return h},i.prototype.isAreaEmpty=function(a,b,c,d){var e=this.whatIsHere(a,b,c,d);return 0===e.length},i.prototype.findFreeSpace=function(a,b,c){var d,e,f=null,g=[];for( -// first free for 1x1 or we have specified width and height -a||(a=1),b||(b=1),d=0;d<=this.width-a&&!f;d++)for(e=0;e<=this.height-b&&!f;e++)g=this.whatIsHere(d,e,a,b),(!g.length||c&&1===g.length&&g[0]===c)&&(f={x:d,y:e,w:a,h:b});return f},i.prototype._sortNodes=function(a){this.nodes=g.sort(this.nodes,a,this.width)},i.prototype._packNodes=function(){this._sortNodes(),this["float"]?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&"undefined"!=typeof a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(g._didCollide,{n:a,newY:d})).value();e||(a._dirty=!0,a.y=d),--d}},this)):b.each(this.nodes,b.bind(function(a,c){if(!a.locked)for(;a.y>0;){var d=a.y-1,e=0===c;if(c>0){var f=b.chain(this.nodes).take(c).find(b.bind(g._didCollide,{n:a,newY:d})).value();e="undefined"==typeof f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},i.prototype._prepareNode=function(a,c){return a=b.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),this.height&&a.height>this.height?a.height=this.height:a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(c?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},i.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]="undefined"==typeof a[0]?[]:[a[0]],a[1]="undefined"==typeof a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},i.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},i.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},i.prototype.addNode=function(a,c,d){if(a=this._prepareNode(a),"undefined"!=typeof a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),"undefined"!=typeof a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),"undefined"!=typeof a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++h,a._dirty=!0,a.autoPosition){this._sortNodes();for(var e=0;;++e){var f=e%this.width,i=Math.floor(e/this.width);if(!(f+a.width>this.width||b.find(this.nodes,b.bind(g._isAddNodeIntercepted,{x:f,y:i,node:a})))){a.x=f,a.y=i;break}}}return this.nodes.push(a),"undefined"!=typeof c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a,d),this._packNodes(),this._notify(),a},i.prototype.removeNode=function(a,c){a&&(a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c))},i.prototype.canMoveNode=function(c,d,e,f,g){if(!this.isNodeChangedPosition(c,d,e,f,g))return!1;var h=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!h)return!0;var j,k=new i(this.width,null,this["float"],0,b.map(this.nodes,function(b){return b==c?j=a.extend({},b):a.extend({},b)}));if("undefined"==typeof j)return!0;k.moveNode(j,d,e,f,g,!1,!0);var l=!0; -// always allow moving the one out of bounds -return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=j&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height,c.y+c.height>this.height&&(l=!0)),l},i.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new i(this.width,null,this["float"],0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c,!1,!0),d.getGridHeight()<=this.height},i.prototype.isNodeChangedPosition=function(a,b,c,d,e){return"number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},i.prototype.moveNode=function(a,b,c,d,e,f,g){if(!this.isNodeChangedPosition(a,b,c,d,e))return a;if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),"undefined"!=typeof a.maxWidth&&(d=Math.min(d,a.maxWidth)),"undefined"!=typeof a.maxHeight&&(e=Math.min(e,a.maxHeight)),"undefined"!=typeof a.minWidth&&(d=Math.max(d,a.minWidth)),"undefined"!=typeof a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;var h=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a.lastTriedX=b,a.lastTriedY=c,a.lastTriedWidth=d,a.lastTriedHeight=e,a=this._prepareNode(a,h),this._fixCollisions(a,g),f||(this._packNodes(),this._notify()),a},i.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},i.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},i.prototype.endUpdate=function(){b.each(this.nodes,function(a){a._origY=a.y});var a=b.find(this.nodes,function(a){return a._updating});a&&(a._updating=!1)};var j=function(d,e){var g,h,j=this;e=e||{},this.container=a(d), -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -"undefined"!=typeof e.handle_class&&(e.handleClass=e.handle_class,f("handle_class","handleClass")),"undefined"!=typeof e.item_class&&(e.itemClass=e.item_class,f("item_class","itemClass")),"undefined"!=typeof e.placeholder_class&&(e.placeholderClass=e.placeholder_class,f("placeholder_class","placeholderClass")),"undefined"!=typeof e.placeholder_text&&(e.placeholderText=e.placeholder_text,f("placeholder_text","placeholderText")),"undefined"!=typeof e.cell_height&&(e.cellHeight=e.cell_height,f("cell_height","cellHeight")),"undefined"!=typeof e.vertical_margin&&(e.verticalMargin=e.vertical_margin,f("vertical_margin","verticalMargin")),"undefined"!=typeof e.min_width&&(e.minWidth=e.min_width,f("min_width","minWidth")),"undefined"!=typeof e.static_grid&&(e.staticGrid=e.static_grid,f("static_grid","staticGrid")),"undefined"!=typeof e.is_nested&&(e.isNested=e.is_nested,f("is_nested","isNested")),"undefined"!=typeof e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,f("always_show_resize_handle","alwaysShowResizeHandle")), -// jscs:enable requireCamelCaseOrUpperCaseIdentifiers -e.itemClass=e.itemClass||"grid-stack-item";var k=this.container.closest("."+e.itemClass).length>0;if(this.opts=b.defaults(e||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,"float":!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:e.alwaysShowResizeHandle||!1,resizable:b.defaults(e.resizable||{},{autoHide:!e.alwaysShowResizeHandle,handles:"se"}),draggable:b.defaults(e.draggable||{},{handle:(e.handleClass?"."+e.handleClass:e.handle?e.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:e.disableDrag||!1,disableResize:e.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px",oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),this.opts.ddPlugin===!1?this.opts.ddPlugin=c:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.first(c.registeredPlugins)||c),this.dd=new this.opts.ddPlugin(this),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=k,h="auto"===this.opts.cellHeight,h?j.cellHeight(j.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),k&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new i(this.opts.width,function(a,c){c="undefined"==typeof c||c;var d=0;b.each(a,function(a){c&&null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),d=Math.max(d,a.y+a.height))}),j._updateStyles(j.opts.height||max_height+10)},this.opts["float"],this.opts.height),this.opts.auto){var l=[],m=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),l.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*m.opts.width})}),b.chain(l).sortBy(function(a){return a.i}).each(function(a){j._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(), -// setting styles also for empty grids -this._updateStyles(),this._updateHeightsOnResize=b.throttle(function(){j.cellHeight(j.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&j._updateHeightsOnResize(),j._isOneColumnMode()){if(g)return;j.container.addClass(j.opts.oneColumnModeClass),g=!0,j.grid._sortNodes(),b.each(j.grid.nodes,function(a){j.container.append(a.el),j.opts.staticGrid||((a.noMove||j.opts.disableDrag)&&j.dd.draggable(a.el,"disable"),(a.noResize||j.opts.disableResize)&&j.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!g)return;if(j.container.removeClass(j.opts.oneColumnModeClass),g=!1,j.opts.staticGrid)return;b.each(j.grid.nodes,function(a){a.noMove||j.opts.disableDrag||j.dd.draggable(a.el,"enable"),a.noResize||j.opts.disableResize||j.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!j.opts.staticGrid&&"string"==typeof j.opts.removable){var n=a(j.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+j.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===j&&j._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable),e=d.data("_gridstack_node");e._grid===j&&j._clearRemovingTimeout(d)})}if(!j.opts.staticGrid&&j.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=j.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!j.grid.canMoveNode(d,f,g))return;j.grid.moveNode(d,f,g),j._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,j.grid.cleanNodes(),j.grid.beginUpdate(d),j.grid.addNode(d),j.container.append(j.placeholder),j.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=j.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,j._updateContainerHeight()};this.dd.droppable(j.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==j)&&b.is(j.opts.acceptWidgets===!0?".grid-stack-item":j.opts.acceptWidgets)}}).on(j.container,"dropover",function(b,c){var d=(j.container.offset(),a(c.draggable)),e=j.cellWidth(),f=j.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),i=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=j.grid._prepareNode({width:h,height:i,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(j.container,"dropout",function(b,c){var d=a(c.draggable);d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,j.grid.removeNode(e),j.placeholder.detach(),j._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}).on(j.container,"drop",function(b,c){j.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=j;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d),a(c.draggable).remove(),d.el=e,j.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).addClass(j.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),j.container.append(e),j._prepareElementsByNode(e,d),j._updateContainerHeight(),j._triggerChangeEvent(),j.grid.endUpdate()})}}; -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -// jscs:enable requireCamelCaseOrUpperCaseIdentifiers -return j.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||a===!0)&&this.container.trigger("change",d)},j.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[b.map(this.grid._addedNodes,b.clone)]),this.grid._addedNodes=[])},j.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[b.map(this.grid._removedNodes,b.clone)]),this.grid._removedNodes=[])},j.prototype._initStyles=function(){this._stylesId&&g.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=g.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},j.prototype._updateStyles=function(a){if(null!==this._styles&&"undefined"!=typeof this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if("undefined"==typeof a&&(a=this._styles._max||this.opts.height,this._initStyles(),this._updateContainerHeight()),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&g.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;e=f.grid.width||k<0||f.grid.height&&k>=f.grid.height?(f.opts.removable===!0&&f._setupRemovingTimeout(b),j=c._beforeDragX,k=c._beforeDragY,f.placeholder.detach(),f.placeholder.hide(),f.grid.removeNode(c),f._updateContainerHeight(),c._temporaryRemoved=!0):(f._clearRemovingTimeout(b),c._temporaryRemoved&&(f.grid.addNode(c),f.placeholder.attr("data-gs-x",j).attr("data-gs-y",k).attr("data-gs-width",h).attr("data-gs-height",i).show(),f.container.append(f.placeholder),c.el=f.placeholder,c._temporaryRemoved=!1));else if("resize"==a.type&&j<0)return; -// width and height are undefined if not resizing -var l="undefined"!=typeof h?h:c.lastTriedWidth,m="undefined"!=typeof i?i:c.lastTriedHeight;!f.grid.canMoveNode(c,j,k,h,i)||c.lastTriedX===j&&c.lastTriedY===k&&c.lastTriedWidth===l&&c.lastTriedHeight===m||(c.lastTriedX=j,c.lastTriedY=k,c.lastTriedWidth=h,c.lastTriedHeight=i,f.grid.moveNode(c,j,k,h,i),f._updateContainerHeight())},h=function(g,h){if(f.opts.draggable.handle&&"dragstart"===g.type&&!a(g.originalEvent.target).closest(f.opts.draggable.handle).length)return!1;f.container.append(f.placeholder);var i=a(this);f.grid.cleanNodes(),f.grid.beginUpdate(c),d=f.cellWidth();var j=Math.ceil(i.outerHeight()/i.attr("data-gs-height"));e=f.container.height()/parseInt(f.container.attr("data-gs-current-height")),f.placeholder.attr("data-gs-x",i.attr("data-gs-x")).attr("data-gs-y",i.attr("data-gs-y")).attr("data-gs-width",i.attr("data-gs-width")).attr("data-gs-height",i.attr("data-gs-height")).show(),c.el=f.placeholder,c._beforeDragX=c.x,c._beforeDragY=c.y,f.dd.resizable(b,"option","minWidth",d*(c.minWidth||1)),f.dd.resizable(b,"option","minHeight",j*(c.minHeight||1)),"resizestart"==g.type&&i.find(".grid-stack-item").trigger("resizestart")},i=function(d,e){var g=a(this);if(g.data("_gridstack_node")){var h=!1;f.placeholder.detach(),c.el=g,f.placeholder.hide(),c._isAboutToRemove?(h=!0,b.removeData("_gridstack_node"),b.remove()):(f._clearRemovingTimeout(b),c._temporaryRemoved?(g.attr("data-gs-x",c._beforeDragX).attr("data-gs-y",c._beforeDragY).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style"),c.x=c._beforeDragX,c.y=c._beforeDragY,f.grid.addNode(c)):g.attr("data-gs-x",c.x).attr("data-gs-y",c.y).attr("data-gs-width",c.width).attr("data-gs-height",c.height).removeAttr("style")),f._updateContainerHeight(),f._triggerChangeEvent(h),f.grid.endUpdate();var i=g.find(".grid-stack");i.length&&"resizestop"==d.type&&(i.each(function(b,c){a(c).data("gridstack").onResizeHandler()}),g.find(".grid-stack-item").trigger("resizestop"))}};this.dd.draggable(b,{start:h,stop:i,drag:g}).resizable(b,{start:h,stop:i,resize:g}),(c.noMove||this._isOneColumnMode()||this.opts.disableDrag)&&this.dd.draggable(b,"disable"),(c.noResize||this._isOneColumnMode()||this.opts.disableResize)&&this.dd.resizable(b,"disable"),b.attr("data-gs-locked",c.locked?"yes":null)}},j.prototype._prepareElement=function(b,c){c="undefined"!=typeof c&&c;var d=this;b=a(b),b.addClass(this.opts.itemClass);var e=d.grid.addNode({x:b.attr("data-gs-x"),y:b.attr("data-gs-y"),width:b.attr("data-gs-width"),height:b.attr("data-gs-height"),maxWidth:b.attr("data-gs-max-width"),minWidth:b.attr("data-gs-min-width"),maxHeight:b.attr("data-gs-max-height"),minHeight:b.attr("data-gs-min-height"),autoPosition:g.toBool(b.attr("data-gs-auto-position")),noResize:g.toBool(b.attr("data-gs-no-resize")),noMove:g.toBool(b.attr("data-gs-no-move")),locked:g.toBool(b.attr("data-gs-locked")),el:b,id:b.attr("data-gs-id"),_grid:d},c);b.data("_gridstack_node",e),this._prepareElementsByNode(b,e)},j.prototype.setAnimation=function(a){a?this.container.addClass("grid-stack-animate"):this.container.removeClass("grid-stack-animate")},j.prototype.addWidget=function(b,c,d,e,f,g,h,i,j,k,l){return b=a(b),"undefined"!=typeof c&&b.attr("data-gs-x",c),"undefined"!=typeof d&&b.attr("data-gs-y",d),"undefined"!=typeof e&&b.attr("data-gs-width",e),"undefined"!=typeof f&&b.attr("data-gs-height",f),"undefined"!=typeof g&&b.attr("data-gs-auto-position",g?"yes":null),"undefined"!=typeof h&&b.attr("data-gs-min-width",h),"undefined"!=typeof i&&b.attr("data-gs-max-width",i),"undefined"!=typeof j&&b.attr("data-gs-min-height",j),"undefined"!=typeof k&&b.attr("data-gs-max-height",k),"undefined"!=typeof l&&b.attr("data-gs-id",l),this.container.append(b),this.makeWidget(b),b},j.prototype.makeWidget=function(b){return b=a(b),this._prepareElement(b,!0),this._triggerAddEvent(),this._updateContainerHeight(),this._triggerChangeEvent(!0),b},j.prototype.willItFit=function(a,b,c,d,e){var f={x:a,y:b,width:c,height:d,autoPosition:e};return this.grid.canBePlacedWithRespectToHeight(f)},j.prototype.removeWidget=function(b,c){c="undefined"==typeof c||c,b=a(b);var d=b.data("_gridstack_node"); -// For Meteor support: https://github.com/troolee/gridstack.js/pull/272 -d||(d=this.grid.getNodeDataByDOMEl(b)),this.grid.removeNode(d,c),b.removeData("_gridstack_node"),this._updateContainerHeight(),c&&b.remove(),this._triggerChangeEvent(!0),this._triggerRemoveEvent()},j.prototype.removeAll=function(a){b.each(this.grid.nodes,b.bind(function(b){this.removeWidget(b.el,a)},this)),this.grid.nodes=[],this._updateContainerHeight()},j.prototype.destroy=function(b){a(window).off("resize",this.onResizeHandler),this.disable(),"undefined"==typeof b||b?this.container.remove():(this.removeAll(!1),this.container.removeData("gridstack")),g.removeStylesheet(this._stylesId),this.grid&&(this.grid=null)},j.prototype.resizable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");"undefined"==typeof f||null===f||"undefined"==typeof a.ui||d.opts.staticGrid||(f.noResize=!c,f.noResize||d._isOneColumnMode()?d.dd.resizable(e,"disable"):d.dd.resizable(e,"enable"))}),this},j.prototype.movable=function(b,c){var d=this;return b=a(b),b.each(function(b,e){e=a(e);var f=e.data("_gridstack_node");"undefined"==typeof f||null===f||"undefined"==typeof a.ui||d.opts.staticGrid||(f.noMove=!c,f.noMove||d._isOneColumnMode()?(d.dd.draggable(e,"disable"),e.removeClass("ui-draggable-handle")):(d.dd.draggable(e,"enable"),e.addClass("ui-draggable-handle")))}),this},j.prototype.enableMove=function(a,b){this.movable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableDrag=!a)},j.prototype.enableResize=function(a,b){this.resizable(this.container.children("."+this.opts.itemClass),a),b&&(this.opts.disableResize=!a)},j.prototype.disable=function(){this.movable(this.container.children("."+this.opts.itemClass),!1),this.resizable(this.container.children("."+this.opts.itemClass),!1),this.container.trigger("disable")},j.prototype.enable=function(){this.movable(this.container.children("."+this.opts.itemClass),!0),this.resizable(this.container.children("."+this.opts.itemClass),!0),this.container.trigger("enable")},j.prototype.locked=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(e.locked=c||!1,d.attr("data-gs-locked",e.locked?"yes":null))}),this},j.prototype.maxHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.maxHeight=c||!1,d.attr("data-gs-max-height",c)))}),this},j.prototype.minHeight=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.minHeight=c||!1,d.attr("data-gs-min-height",c)))}),this},j.prototype.maxWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.maxWidth=c||!1,d.attr("data-gs-max-width",c)))}),this},j.prototype.minWidth=function(b,c){return b=a(b),b.each(function(b,d){d=a(d);var e=d.data("_gridstack_node");"undefined"!=typeof e&&null!==e&&(isNaN(c)||(e.minWidth=c||!1,d.attr("data-gs-min-width",c)))}),this},j.prototype._updateElement=function(b,c){b=a(b).first();var d=b.data("_gridstack_node");if("undefined"!=typeof d&&null!==d){var e=this;e.grid.cleanNodes(),e.grid.beginUpdate(d),c.call(this,b,d),e._updateContainerHeight(),e._triggerChangeEvent(),e.grid.endUpdate()}},j.prototype.resize=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&"undefined"!=typeof b?b:d.width,c=null!==c&&"undefined"!=typeof c?c:d.height,this.grid.moveNode(d,d.x,d.y,b,c)})},j.prototype.move=function(a,b,c){this._updateElement(a,function(a,d){b=null!==b&&"undefined"!=typeof b?b:d.x,c=null!==c&&"undefined"!=typeof c?c:d.y,this.grid.moveNode(d,b,c,d.width,d.height)})},j.prototype.update=function(a,b,c,d,e){this._updateElement(a,function(a,f){b=null!==b&&"undefined"!=typeof b?b:f.x,c=null!==c&&"undefined"!=typeof c?c:f.y,d=null!==d&&"undefined"!=typeof d?d:f.width,e=null!==e&&"undefined"!=typeof e?e:f.height,this.grid.moveNode(f,b,c,d,e)})},j.prototype.verticalMargin=function(a,b){if("undefined"==typeof a)return this.opts.verticalMargin;var c=g.parseHeight(a);this.opts.verticalMarginUnit===c.unit&&this.opts.height===c.height||(this.opts.verticalMarginUnit=c.unit,this.opts.verticalMargin=c.height,b||this._updateStyles())},j.prototype.cellHeight=function(a,b){if("undefined"==typeof a){if(this.opts.cellHeight)return this.opts.cellHeight;var c=this.container.children("."+this.opts.itemClass).first();return Math.ceil(c.outerHeight()/c.attr("data-gs-height"))}var d=g.parseHeight(a);this.opts.cellHeightUnit===d.heightUnit&&this.opts.height===d.height||(this.opts.cellHeightUnit=d.unit,this.opts.cellHeight=d.height,b||this._updateStyles())},j.prototype.cellWidth=function(){return Math.round(this.container.outerWidth()/this.opts.width)},j.prototype.getCellFromPixel=function(a,b){var c="undefined"!=typeof b&&b?this.container.offset():this.container.position(),d=a.left-c.left,e=a.top-c.top,f=Math.floor(this.container.width()/this.opts.width),g=Math.floor(this.container.height()/parseInt(this.container.attr("data-gs-current-height")));return{x:Math.floor(d/f),y:Math.floor(e/g)}},j.prototype.batchUpdate=function(){this.grid.batchUpdate()},j.prototype.commit=function(){this.grid.commit(),this._updateContainerHeight()},j.prototype.isAreaEmpty=function(a,b,c,d){return this.grid.isAreaEmpty(a,b,c,d)},j.prototype.findFreeSpace=function(a,b){return this.grid.findFreeSpace(a,b)},j.prototype.setStatic=function(a){this.opts.staticGrid=a===!0,this.enableMove(!a),this.enableResize(!a),this._setStaticClass()},j.prototype._setStaticClass=function(){var a="grid-stack-static";this.opts.staticGrid===!0?this.container.addClass(a):this.container.removeClass(a)},j.prototype.refreshNodes=function(b){var c=this;this.removeAll(!1),this.container.find("."+this.opts.itemClass).each(function(b,d){a(d).off("dragstart dragstop drag resizestart resizestop resize"),c.makeWidget(d)}),this.opts.staticGrid&&b||(b?this.disable():this.enable())},j.prototype.getCellFromAbsolutePixel=function(a){var b=this.container.offset(),c=this.container.position(); -// offset relative to gridstack container itself -return a={left:a.left-b.left+c.left,top:a.top-b.top+c.top},this.getCellFromPixel(a)},j.prototype._updateNodeWidths=function(a,b){this.grid._sortNodes(),this.grid.batchUpdate();for(var c={},d=0;dthis.height||a<0||a+c>this.width)return!1;var f=this.whatIsHere(a,b,c,d);return!f.length||e&&1===f.length&&f[0]===e},i.prototype.findFreeSpace=function(a,b,c){var d,e,f=null;for(a||(a=1),b||(b=1),d=0;d<=this.width-a&&!f;d++)for(e=0;e<=this.height-b&&!f;e++)this.isAreaEmpty(d,e,a,b,c)&&(f={x:d,y:e,w:a,h:b});return f},i.prototype._sortNodes=function(a){this.nodes=g.sort(this.nodes,a,this.width)},i.prototype._packNodes=function(){this._sortNodes(),this.float?b.each(this.nodes,b.bind(function(a,c){if(!a._updating&&void 0!==a._origY&&a.y!=a._origY)for(var d=a.y;d>=a._origY;){var e=b.chain(this.nodes).find(b.bind(g._didCollide,{n:a,newY:d})).value();e||(a._dirty=!0,a.y=d),--d}},this)):b.each(this.nodes,b.bind(function(a,c){if(!a.locked)for(;a.y>0;){var d=a.y-1,e=0===c;if(c>0){var f=b.chain(this.nodes).take(c).find(b.bind(g._didCollide,{n:a,newY:d})).value();e=void 0===f}if(!e)break;a._dirty=a.y!=d,a.y=d}},this))},i.prototype._prepareNode=function(a,c){return a=b.defaults(a||{},{width:1,height:1,x:0,y:0}),a.x=parseInt(""+a.x),a.y=parseInt(""+a.y),a.width=parseInt(""+a.width),a.height=parseInt(""+a.height),a.autoPosition=a.autoPosition||!1,a.noResize=a.noResize||!1,a.noMove=a.noMove||!1,a.width>this.width?a.width=this.width:a.width<1&&(a.width=1),this.height&&a.height>this.height?a.height=this.height:a.height<1&&(a.height=1),a.x<0&&(a.x=0),a.x+a.width>this.width&&(c?a.width=this.width-a.x:a.x=this.width-a.width),a.y<0&&(a.y=0),a},i.prototype._notify=function(){var a=Array.prototype.slice.call(arguments,0);if(a[0]=void 0===a[0]?[]:[a[0]],a[1]=void 0===a[1]||a[1],!this._updateCounter){var b=a[0].concat(this.getDirtyNodes());this.onchange(b,a[1])}},i.prototype.cleanNodes=function(){this._updateCounter||b.each(this.nodes,function(a){a._dirty=!1})},i.prototype.getDirtyNodes=function(){return b.filter(this.nodes,function(a){return a._dirty})},i.prototype.addNode=function(a,c){if(a=this._prepareNode(a),void 0!==a.maxWidth&&(a.width=Math.min(a.width,a.maxWidth)),void 0!==a.maxHeight&&(a.height=Math.min(a.height,a.maxHeight)),void 0!==a.minWidth&&(a.width=Math.max(a.width,a.minWidth)),void 0!==a.minHeight&&(a.height=Math.max(a.height,a.minHeight)),a._id=++h,a._dirty=!0,a.autoPosition){this._sortNodes();for(var d=0;;++d){var e=d%this.width,f=Math.floor(d/this.width);if(!(e+a.width>this.width)&&!b.find(this.nodes,b.bind(g._isAddNodeIntercepted,{x:e,y:f,node:a}))){a.x=e,a.y=f;break}}}return this.nodes.push(a),void 0!==c&&c&&this._addedNodes.push(b.clone(a)),this._fixCollisions(a),this._packNodes(),this._notify(),a},i.prototype.removeNode=function(a,c){a&&(a._id=null,this.nodes=b.without(this.nodes,a),this._packNodes(),this._notify(a,c))},i.prototype.canMoveNode=function(c,d,e,f,g){if(!this.isNodeChangedPosition(c,d,e,f,g))return!1;var h=Boolean(b.find(this.nodes,function(a){return a.locked}));if(!this.height&&!h)return!0;if(!this.isAreaEmpty(d,e,f,g,c))return!1;var j,k=new i(this.width,null,this.float,0,b.map(this.nodes,function(b){return b==c?j=a.extend({},b):a.extend({},b)}));if(void 0===j)return!0;k.moveNode(j,d,e,f,g);var l=!0;return h&&(l&=!Boolean(b.find(k.nodes,function(a){return a!=j&&Boolean(a.locked)&&Boolean(a._dirty)}))),this.height&&(l&=k.getGridHeight()<=this.height,c.y+c.height>this.height&&(l=!0)),l},i.prototype.canBePlacedWithRespectToHeight=function(c){if(!this.height)return!0;var d=new i(this.width,null,this.float,0,b.map(this.nodes,function(b){return a.extend({},b)}));return d.addNode(c),d.getGridHeight()<=this.height},i.prototype.isNodeChangedPosition=function(a,b,c,d,e){return"number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x!=b||a.y!=c||a.width!=d||a.height!=e},i.prototype.moveNode=function(a,b,c,d,e,f){if(!this.isNodeChangedPosition(a,b,c,d,e))return a;if("number"!=typeof b&&(b=a.x),"number"!=typeof c&&(c=a.y),"number"!=typeof d&&(d=a.width),"number"!=typeof e&&(e=a.height),void 0!==a.maxWidth&&(d=Math.min(d,a.maxWidth)),void 0!==a.maxHeight&&(e=Math.min(e,a.maxHeight)),void 0!==a.minWidth&&(d=Math.max(d,a.minWidth)),void 0!==a.minHeight&&(e=Math.max(e,a.minHeight)),a.x==b&&a.y==c&&a.width==d&&a.height==e)return a;if(!this.isAreaEmpty(b,c,d,e,a))return a;var g=a.width!=d;return a._dirty=!0,a.x=b,a.y=c,a.width=d,a.height=e,a.lastTriedX=b,a.lastTriedY=c,a.lastTriedWidth=d,a.lastTriedHeight=e,a=this._prepareNode(a,g),this._fixCollisions(a),f||(this._packNodes(),this._notify()),a},i.prototype.getGridHeight=function(){return b.reduce(this.nodes,function(a,b){return Math.max(a,b.y+b.height)},0)},i.prototype.beginUpdate=function(a){b.each(this.nodes,function(a){a._origY=a.y}),a._updating=!0},i.prototype.endUpdate=function(){b.each(this.nodes,function(a){a._origY=a.y});var a=b.find(this.nodes,function(a){return a._updating});a&&(a._updating=!1)};var j=function(d,e){var g,h,j=this;e=e||{},this.container=a(d),void 0!==e.handle_class&&(e.handleClass=e.handle_class,f("handle_class","handleClass")),void 0!==e.item_class&&(e.itemClass=e.item_class,f("item_class","itemClass")),void 0!==e.placeholder_class&&(e.placeholderClass=e.placeholder_class,f("placeholder_class","placeholderClass")),void 0!==e.placeholder_text&&(e.placeholderText=e.placeholder_text,f("placeholder_text","placeholderText")),void 0!==e.cell_height&&(e.cellHeight=e.cell_height,f("cell_height","cellHeight")),void 0!==e.vertical_margin&&(e.verticalMargin=e.vertical_margin,f("vertical_margin","verticalMargin")),void 0!==e.min_width&&(e.minWidth=e.min_width,f("min_width","minWidth")),void 0!==e.static_grid&&(e.staticGrid=e.static_grid,f("static_grid","staticGrid")),void 0!==e.is_nested&&(e.isNested=e.is_nested,f("is_nested","isNested")),void 0!==e.always_show_resize_handle&&(e.alwaysShowResizeHandle=e.always_show_resize_handle,f("always_show_resize_handle","alwaysShowResizeHandle")),e.itemClass=e.itemClass||"grid-stack-item";var k=this.container.closest("."+e.itemClass).length>0;if(this.opts=b.defaults(e||{},{width:parseInt(this.container.attr("data-gs-width"))||12,height:parseInt(this.container.attr("data-gs-height"))||0,itemClass:"grid-stack-item",placeholderClass:"grid-stack-placeholder",placeholderText:"",handle:".grid-stack-item-content",handleClass:null,cellHeight:60,verticalMargin:20,auto:!0,minWidth:768,float:!1,staticGrid:!1,_class:"grid-stack-instance-"+(1e4*Math.random()).toFixed(0),animate:Boolean(this.container.attr("data-gs-animate"))||!1,alwaysShowResizeHandle:e.alwaysShowResizeHandle||!1,resizable:b.defaults(e.resizable||{},{autoHide:!e.alwaysShowResizeHandle,handles:"se"}),draggable:b.defaults(e.draggable||{},{handle:(e.handleClass?"."+e.handleClass:e.handle?e.handle:"")||".grid-stack-item-content",scroll:!1,appendTo:"body"}),disableDrag:e.disableDrag||!1,disableResize:e.disableResize||!1,rtl:"auto",removable:!1,removeTimeout:2e3,verticalMarginUnit:"px",cellHeightUnit:"px",disableOneColumnMode:e.disableOneColumnMode||!1,oneColumnModeClass:e.oneColumnModeClass||"grid-stack-one-column-mode",ddPlugin:null}),!1===this.opts.ddPlugin?this.opts.ddPlugin=c:null===this.opts.ddPlugin&&(this.opts.ddPlugin=b.first(c.registeredPlugins)||c),this.dd=new this.opts.ddPlugin(this),"auto"===this.opts.rtl&&(this.opts.rtl="rtl"===this.container.css("direction")),this.opts.rtl&&this.container.addClass("grid-stack-rtl"),this.opts.isNested=k,h="auto"===this.opts.cellHeight,h?j.cellHeight(j.cellWidth(),!0):this.cellHeight(this.opts.cellHeight,!0),this.verticalMargin(this.opts.verticalMargin,!0),this.container.addClass(this.opts._class),this._setStaticClass(),k&&this.container.addClass("grid-stack-nested"),this._initStyles(),this.grid=new i(this.opts.width,function(a,c){c=void 0===c||c;var d=0;b.each(a,function(a){c&&null===a._id?a.el&&a.el.remove():(a.el.attr("data-gs-x",a.x).attr("data-gs-y",a.y).attr("data-gs-width",a.width).attr("data-gs-height",a.height),d=Math.max(d,a.y+a.height))}),j._updateStyles(j.opts.height||max_height+10)},this.opts.float,this.opts.height),this.opts.auto){var l=[],m=this;this.container.children("."+this.opts.itemClass+":not(."+this.opts.placeholderClass+")").each(function(b,c){c=a(c),l.push({el:c,i:parseInt(c.attr("data-gs-x"))+parseInt(c.attr("data-gs-y"))*m.opts.width})}),b.chain(l).sortBy(function(a){return a.i}).each(function(a){j._prepareElement(a.el)}).value()}if(this.setAnimation(this.opts.animate),this.placeholder=a('
'+this.opts.placeholderText+"
").hide(),this._updateContainerHeight(),this._updateStyles(),this._updateHeightsOnResize=b.throttle(function(){j.cellHeight(j.cellWidth(),!1)},100),this.onResizeHandler=function(){if(h&&j._updateHeightsOnResize(),j._isOneColumnMode()&&!j.opts.disableOneColumnMode){if(g)return;j.container.addClass(j.opts.oneColumnModeClass),g=!0,j.grid._sortNodes(),b.each(j.grid.nodes,function(a){j.container.append(a.el),j.opts.staticGrid||(j.dd.draggable(a.el,"disable"),j.dd.resizable(a.el,"disable"),a.el.trigger("resize"))})}else{if(!g)return;if(j.container.removeClass(j.opts.oneColumnModeClass),g=!1,j.opts.staticGrid)return;b.each(j.grid.nodes,function(a){a.noMove||j.opts.disableDrag||j.dd.draggable(a.el,"enable"),a.noResize||j.opts.disableResize||j.dd.resizable(a.el,"enable"),a.el.trigger("resize")})}},a(window).resize(this.onResizeHandler),this.onResizeHandler(),!j.opts.staticGrid&&"string"==typeof j.opts.removable){var n=a(j.opts.removable);this.dd.isDroppable(n)||this.dd.droppable(n,{accept:"."+j.opts.itemClass}),this.dd.on(n,"dropover",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._setupRemovingTimeout(d)}).on(n,"dropout",function(b,c){var d=a(c.draggable);d.data("_gridstack_node")._grid===j&&j._clearRemovingTimeout(d)})}if(!j.opts.staticGrid&&j.opts.acceptWidgets){var o=null,p=function(a,b){var c=o,d=c.data("_gridstack_node"),e=j.getCellFromPixel(b.offset,!0),f=Math.max(0,e.x),g=Math.max(0,e.y);if(d._added){if(!j.grid.canMoveNode(d,f,g))return;j.grid.moveNode(d,f,g),j._updateContainerHeight()}else d._added=!0,d.el=c,d.x=f,d.y=g,j.grid.cleanNodes(),j.grid.beginUpdate(d),j.grid.addNode(d),j.container.append(j.placeholder),j.placeholder.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).show(),d.el=j.placeholder,d._beforeDragX=d.x,d._beforeDragY=d.y,j._updateContainerHeight()};this.dd.droppable(j.container,{accept:function(b){b=a(b);var c=b.data("_gridstack_node");return(!c||c._grid!==j)&&b.is(!0===j.opts.acceptWidgets?".grid-stack-item":j.opts.acceptWidgets)}}).on(j.container,"dropover",function(b,c){var d=(j.container.offset(),a(c.draggable)),e=j.cellWidth(),f=j.cellHeight(),g=d.data("_gridstack_node"),h=g?g.width:Math.ceil(d.outerWidth()/e),i=g?g.height:Math.ceil(d.outerHeight()/f);o=d;var k=j.grid._prepareNode({width:h,height:i,_added:!1,_temporary:!0});d.data("_gridstack_node",k),d.data("_gridstack_node_orig",g),d.on("drag",p)}).on(j.container,"dropout",function(b,c){var d=a(c.draggable);if(d.data("_gridstack_node")){d.unbind("drag",p);var e=d.data("_gridstack_node");e.el=null,j.grid.removeNode(e),j.placeholder.detach(),j._updateContainerHeight(),d.data("_gridstack_node",d.data("_gridstack_node_orig"))}}).on(j.container,"drop",function(b,c){j.placeholder.detach();var d=a(c.draggable).data("_gridstack_node");d._grid=j;var e=a(c.draggable).clone(!1);e.data("_gridstack_node",d);var f=a(c.draggable).data("_gridstack_node_orig");void 0!==f&&void 0!==f._grid&&f._grid._triggerRemoveEvent(),a(c.helper).remove(),d.el=e,j.placeholder.hide(),e.attr("data-gs-x",d.x).attr("data-gs-y",d.y).attr("data-gs-width",d.width).attr("data-gs-height",d.height).addClass(j.opts.itemClass).removeAttr("style").enableSelection().removeData("draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled").unbind("drag",p),j.container.append(e),j._prepareElementsByNode(e,d),j._updateContainerHeight(),j.grid._addedNodes.push(d),j._triggerAddEvent(),j._triggerChangeEvent(),j.grid.endUpdate(),a(c.draggable).unbind("drag",p),a(c.draggable).removeData("_gridstack_node"),a(c.draggable).removeData("_gridstack_node_orig")})}};return j.prototype._triggerChangeEvent=function(a){var b=this.grid.getDirtyNodes(),c=!1,d=[];b&&b.length&&(d.push(b),c=!0),(c||!0===a)&&this.container.trigger("change",d)},j.prototype._triggerAddEvent=function(){this.grid._addedNodes&&this.grid._addedNodes.length>0&&(this.container.trigger("added",[b.map(this.grid._addedNodes,b.clone)]),this.grid._addedNodes=[])},j.prototype._triggerRemoveEvent=function(){this.grid._removedNodes&&this.grid._removedNodes.length>0&&(this.container.trigger("removed",[b.map(this.grid._removedNodes,b.clone)]),this.grid._removedNodes=[])},j.prototype._initStyles=function(){this._stylesId&&g.removeStylesheet(this._stylesId),this._stylesId="gridstack-style-"+(1e5*Math.random()).toFixed(),this._styles=g.createStylesheet(this._stylesId),null!==this._styles&&(this._styles._max=0)},j.prototype._updateStyles=function(a){if(null!==this._styles&&void 0!==this._styles){var b,c="."+this.opts._class+" ."+this.opts.itemClass,d=this;if(void 0===a&&(a=this._styles._max||this.opts.height,this._initStyles(),this._updateContainerHeight()),this._initStyles(),this._updateContainerHeight(),this.opts.cellHeight&&!(0!==this._styles._max&&a<=this._styles._max)&&(b=this.opts.verticalMargin&&this.opts.cellHeightUnit!==this.opts.verticalMarginUnit?function(a,b){return a&&b?"calc("+(d.opts.cellHeight*a+d.opts.cellHeightUnit)+" + "+(d.opts.verticalMargin*b+d.opts.verticalMarginUnit)+")":d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit}:function(a,b){return d.opts.cellHeight*a+d.opts.verticalMargin*b+d.opts.cellHeightUnit},0===this._styles._max&&g.insertCSSRule(this._styles,c,"min-height: "+b(1,0)+";",0),a>this._styles._max)){for(var e=this._styles._max;e + +**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* + +- [v1.0.0 (development)](#v100-development) +- [v0.3.0 (2017-04-21)](#v030-2017-04-21) +- [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) +- [v0.2.2 (2014-12-23)](#v022-2014-12-23) +- [v0.2.1 (2014-12-09)](#v021-2014-12-09) +- [v0.2.0 (2014-11-30)](#v020-2014-11-30) +- [v0.1.0 (2014-11-18)](#v010-2014-11-18) + + + +## v1.0.0 (development) + +- widgets can have their own resize handles. Use `data-gs-resize-handles` element attribute to use. For example, `data-gs-resize-handles="e,w"` will make the particular widget only resize west and east. ([#494](https://github.com/troolee/gridstack.js/issues/494)). +- enable sidebar items to be duplicated properly. Pass `helper: 'clone'` in `draggable` options. ([#661](https://github.com/troolee/gridstack.js/issues/661), ([#396](https://github.com/troolee/gridstack.js/issues/396), ([#499](https://github.com/troolee/gridstack.js/issues/499)). + +## v0.3.0 (2017-04-21) + +- remove placeholder when dragging widget below grid (already worked when dragging left, above, and to the right of grid). +- prevent extra checks for removing widget when dragging off grid. +- trigger `added` when a widget is added via dropping from one grid to another. +- trigger `removed` when a widget is removed via dropping from one grid to another. +- trigger `removed` when a widget is removed via dropping on a removable zone ([#607](https://github.com/troolee/gridstack.js/issues/607) and [#550])(https://github.com/troolee/gridstack.js/issues/550)). +- trigger custom event for `resizestop` called `gsresizestop` ([#577](https://github.com/troolee/gridstack.js/issues/577) and [#398](https://github.com/troolee/gridstack.js/issues/398)). +- prevent dragging/resizing in `oneColumnMode` ([#593](https://github.com/troolee/gridstack.js/issues/593)). +- 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. +- `cellHeight` and `verticalMargin` can now be string (e.g. '3em', '20px') (Thanks to @jlowcs). +- add `maxWidth`/`maxHeight` methods. +- add `enableMove`/`enableResize` methods. +- fix window resize issue #331. +- add options `disableDrag` and `disableResize`. +- fix `batchUpdate`/`commit` (Thank to @radiolips) +- remove dependency of FontAwesome +- RTL support +- `'auto'` value for `cellHeight` option +- fix `setStatic` method +- add `setAnimation` method to API +- add `setGridWidth` method ([#227](https://github.com/troolee/gridstack.js/issues/227)) +- add `removable`/`removeTimeout` *(experimental)* +- add `detachGrid` parameter to `destroy` method ([#216](https://github.com/troolee/gridstack.js/issues/216)) (thanks @jhpedemonte) +- add `useOffset` parameter to `getCellFromPixel` method ([#237](https://github.com/troolee/gridstack.js/issues/237)) +- add `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `id` parameters to `addWidget` ([#188](https://github.com/troolee/gridstack.js/issues/188)) +- add `added` and `removed` events for when a widget is added or removed, respectively. ([#54](https://github.com/troolee/gridstack.js/issues/54)) +- add `acceptWidgets` parameter. Widgets can now be draggable between grids or from outside *(experimental)* + +## v0.2.4 (2016-02-15) + +- fix closure compiler/linter warnings +- add `static_grid` option. +- add `min_width`/`min_height` methods (Thanks to @cvillemure) +- add `destroy` method (Thanks to @zspitzer) +- add `placeholder_text` option (Thanks to @slauyama) +- add `handle_class` option. +- add `make_widget` method. +- lodash v 4.x support (Thanks to @andrewr88) + +## v0.2.3 (2015-06-23) + +- gridstack-extra.css +- add support of lodash.js +- add `is_area_empty` method +- nested grids +- add `batch_update`/`commit` methods +- add `update` method +- allow to override `resizable`/`draggable` options +- add `disable`/`enable` methods +- add `get_cell_from_pixel` (thanks to @juchi) +- AMD support +- fix nodes sorting +- improved touch devices support +- add `always_show_resize_handle` option +- minor fixes and improvements + +## v0.2.2 (2014-12-23) + +- fix grid initialization +- add `cell_height`/`cell_width` API methods +- fix boolean attributes (issue #31) + +## v0.2.1 (2014-12-09) + +- add widgets locking (issue #19) +- add `will_it_fit` API method +- fix auto-positioning (issue #20) +- add animation (thanks to @ishields) +- fix `y` coordinate calculation when dragging (issue #18) +- fix `remove_widget` (issue #16) +- minor fixes + + +## v0.2.0 (2014-11-30) + +- add `height` option +- auto-generate css rules (widgets `height` and `top`) +- add `GridStackUI.Utils.sort` utility function +- add `remove_all` API method +- add `resize` and `move` API methods +- add `resizable` and `movable` API methods +- add `data-gs-no-move` attribute +- add `float` option +- fix default css rule for inner content +- minor fixes + +## v0.1.0 (2014-11-18) + +Very first version. \ No newline at end of file diff --git a/doc/FAQ.md b/doc/FAQ.md deleted file mode 100644 index 2e17c546f..000000000 --- a/doc/FAQ.md +++ /dev/null @@ -1,51 +0,0 @@ -Frequently asked questions -========================== - - - -**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) - - - -### 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. diff --git a/doc/README.md b/doc/README.md index 3320fdbde..6e5a309a6 100644 --- a/doc/README.md +++ b/doc/README.md @@ -17,7 +17,7 @@ gridstack.js API - [enable(event)](#enableevent) - [removed(event, items)](#removedevent-items) - [resizestart(event, ui)](#resizestartevent-ui) - - [resizestop(event, ui)](#resizestopevent-ui) + - [gsresizestop(event, ui)](#gsresizestopevent-ui) - [API](#api) - [addWidget(el[, x, y, width, height, autoPosition, minWidth, maxWidth, minHeight, maxHeight, id])](#addwidgetel-x-y-width-height-autoposition-minwidth-maxwidth-minheight-maxheight-id) - [batchUpdate()](#batchupdate) @@ -78,6 +78,7 @@ gridstack.js API - `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 (default: `768`) +- `disableOneColumnMode` - disables the onColumnMode when the window width is less than minWidth (default: 'false') - `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: `''`) @@ -110,6 +111,7 @@ gridstack.js API - `data-gs-locked` - the widget will be locked. It means another widget wouldn't be able to move it during dragging or resizing. The widget can still be dragged or resized. You need to add `data-gs-no-resize` and `data-gs-no-move` attributes to completely lock the widget. +- `data-gs-resize-handles` - sets resize handles for a specific widget. ## Events @@ -192,12 +194,11 @@ $('.grid-stack').on('resizestart', function(event, ui) { }); ``` -### resizestop(event, ui) +### gsresizestop(event, ui) ```javascript -$('.grid-stack').on('resizestop', function(event, ui) { - var grid = this; - var element = event.target; +$('.grid-stack').on('gsresizestop', function(event, elem) { + var newHeight = $(elem).attr('data-gs-height'); }); ``` diff --git a/package.json b/package.json index b203ab8a9..959a9686f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gridstack", - "version": "0.3.0-dev", + "version": "1.0.0-dev", "description": "gridstack.js is a jQuery plugin for widget layout", "main": "dist/gridstack.js", "repository": { @@ -8,7 +8,7 @@ "url": "git+https://github.com/troolee/gridstack.js.git" }, "scripts": { - "build": "grunt", + "build": "grunt ; doctoc ./README.md ; doctoc ./doc/README.md ; doctoc ./doc/CHANGES.md", "test": "karma start karma.conf.js" }, "keywords": [ @@ -19,6 +19,7 @@ "jquery" ], "author": "Pavel Reznikov ", + "contributors": ["Dylan Weiss (https://dylandreams.com)"], "license": "MIT", "bugs": { "url": "https://github.com/troolee/gridstack.js/issues" @@ -32,20 +33,19 @@ "devDependencies": { "connect": "^3.4.1", "coveralls": "^2.11.8", - "doctoc": "^1.0.0", - "grunt": "^0.4.5", + "doctoc": "^1.3.0", + "grunt": "^1.0.1", "grunt-cli": "^1.2.0", - "grunt-contrib-connect": "^0.11.2", - "grunt-contrib-copy": "^0.8.2", - "grunt-contrib-cssmin": "^0.14.0", + "grunt-contrib-connect": "^1.0.2", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-cssmin": "^2.1.0", "grunt-contrib-jshint": "^1.0.0", - "grunt-contrib-uglify": "^0.11.1", - "grunt-contrib-watch": "^0.6.1", - "grunt-doctoc": "^0.1.1", - "grunt-jscs": "^2.8.0", - "grunt-protractor-runner": "^3.2.0", + "grunt-contrib-uglify": "^2.3.0", + "grunt-contrib-watch": "^1.0.0", + "grunt-jscs": "^3.0.1", + "grunt-protractor-runner": "^5.0.0", "grunt-protractor-webdriver": "^0.2.5", - "grunt-sass": "^1.1.0", + "grunt-sass": "^2.0.0", "jasmine-core": "^2.4.1", "karma": "^1.1.2", "karma-coverage": "^1.1.1", diff --git a/src/gridstack.css b/src/gridstack.css index 319d58a75..7feeaffa4 100644 --- a/src/gridstack.css +++ b/src/gridstack.css @@ -302,6 +302,7 @@ transform: rotate(180deg); } */ +/* @media (max-width: 768px) { .grid-stack-item { position: relative !important; @@ -318,3 +319,4 @@ height: auto !important; } } +*/ diff --git a/src/gridstack.jQueryUI.js b/src/gridstack.jQueryUI.js index c5d493615..79b843319 100644 --- a/src/gridstack.jQueryUI.js +++ b/src/gridstack.jQueryUI.js @@ -1,7 +1,7 @@ /** - * gridstack.js 0.3.0-dev + * gridstack.js 1.0.0-dev * http://troolee.github.io/gridstack.js/ - * (c) 2014-2016 Pavel Reznikov, Dylan Weiss + * (c) 2014-2017 Pavel Reznikov, Dylan Weiss * gridstack.js may be freely distributed under the MIT license. * @preserve */ @@ -47,7 +47,11 @@ var value = arguments[3]; el.resizable(opts, key, value); } else { + var handles = el.data('gs-resize-handles') ? el.data('gs-resize-handles') : + this.grid.opts.resizable.handles; el.resizable(_.extend({}, this.grid.opts.resizable, { + handles: handles + }, { start: opts.start || function() {}, stop: opts.stop || function() {}, resize: opts.resize || function() {} diff --git a/src/gridstack.js b/src/gridstack.js index ec983a19d..15fd232e2 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -1,7 +1,7 @@ /** * gridstack.js 0.3.0-dev * http://troolee.github.io/gridstack.js/ - * (c) 2014-2016 Pavel Reznikov, Dylan Weiss + * (c) 2014-2017 Pavel Reznikov, Dylan Weiss * gridstack.js may be freely distributed under the MIT license. * @preserve */ @@ -190,49 +190,24 @@ return _.find(this.nodes, function(n) { return el.get(0) === n.el.get(0); }); }; - GridStackEngine.prototype._fixCollisions = function(node, isClone) { - var self = this; - this._sortNodes(-1); - - var nn = node; - var hasLocked = Boolean(_.find(this.nodes, function(n) { return n.locked; })); - if (!this.float && !hasLocked) { - nn = {x: 0, y: node.y, width: this.width, height: node.height}; - } - while (true) { - var collisionNode = _.find(this.nodes, _.bind(Utils._collisionNodeCheck, {node: node, nn: nn})); - if (typeof collisionNode == 'undefined') { - return; - } - - // will try to fix the collision - var newPos, - newY = node.y + node.height, - wrongPos = !isClone && ((node.y + node.height + collisionNode.height) > this.height); - - if (wrongPos) { - // if the pos is out of bounds, put it on first available - newPos = this.findFreeSpace(collisionNode.width, collisionNode.height, collisionNode); - if (!newPos) { - newPos = this.findFreeSpace(); - } - if (!newPos) { - return; // hmm - } - } else { - newPos = { - x: collisionNode.x, - y: node.y + node.height, - w: collisionNode.width, - h: collisionNode.height - }; - } + GridStackEngine.prototype._fixCollisions = function(node) { + // var self = this; + // this._sortNodes(-1); - if (newPos) { - this.moveNode(collisionNode, newPos.x, newPos.y, newPos.w, newPos.h, true, isClone); - } + // var nn = node; + // var hasLocked = Boolean(_.find(this.nodes, function(n) { return n.locked; })); + // if (!this.float && !hasLocked) { + // nn = {x: 0, y: node.y, width: this.width, height: node.height}; + // } + // while (true) { + // var collisionNode = _.find(this.nodes, _.bind(Utils._collisionNodeCheck, {node: node, nn: nn})); + // if (typeof collisionNode == 'undefined') { + // return; + // } - } + // this.moveNode(collisionNode, collisionNode.x, node.y + node.height, + // collisionNode.width, collisionNode.height, true); + // } }; GridStackEngine.prototype.whatIsHere = function(x, y, width, height) { @@ -243,14 +218,17 @@ return collisionNodes; }; - GridStackEngine.prototype.isAreaEmpty = function(x, y, width, height) { - var collisionNodes = this.whatIsHere(x, y, width, height); - return collisionNodes.length === 0; + GridStackEngine.prototype.isAreaEmpty = function(x, y, width, height, exceptNode) { + // first check if is not out of bounds + if (y < 0 || y + height > this.height || x < 0 || x + width > this.width) { + return false; + } + var collisionNodes = this.whatIsHere(x, y, width, height); + return (!collisionNodes.length || (exceptNode && collisionNodes.length === 1 && collisionNodes[0] === exceptNode)); }; GridStackEngine.prototype.findFreeSpace = function(w, h, forNode) { var freeSpace = null, - nodesHere = [], i, j; // first free for 1x1 or we have specified width and height @@ -265,8 +243,7 @@ if (freeSpace) { break; } - nodesHere = this.whatIsHere(i, j, w, h); - if (!nodesHere.length || (forNode && nodesHere.length === 1 && nodesHere[0] === forNode)) { + if (this.isAreaEmpty(i, j, w, h, forNode)) { freeSpace = {x: i, y: j, w: w, h: h}; } } @@ -392,7 +369,7 @@ return _.filter(this.nodes, function(n) { return n._dirty; }); }; - GridStackEngine.prototype.addNode = function(node, triggerAddEvent, isClone) { + GridStackEngine.prototype.addNode = function(node, triggerAddEvent) { node = this._prepareNode(node); if (typeof node.maxWidth != 'undefined') { node.width = Math.min(node.width, node.maxWidth); } @@ -425,7 +402,7 @@ this._addedNodes.push(_.clone(node)); } - this._fixCollisions(node, isClone); + this._fixCollisions(node); this._packNodes(); this._notify(); return node; @@ -451,6 +428,10 @@ return true; } + if (!this.isAreaEmpty(x, y, width, height, node)) { + return false; + } + var clonedNode; var clone = new GridStackEngine( this.width, @@ -469,7 +450,7 @@ return true; } - clone.moveNode(clonedNode, x, y, width, height, false, true); + clone.moveNode(clonedNode, x, y, width, height); var res = true; @@ -501,7 +482,7 @@ this.float, 0, _.map(this.nodes, function(n) { return $.extend({}, n); })); - clone.addNode(node, false, true); + clone.addNode(node); return clone.getGridHeight() <= this.height; }; @@ -522,7 +503,7 @@ return true; }; - GridStackEngine.prototype.moveNode = function(node, x, y, width, height, noPack, isClone) { + GridStackEngine.prototype.moveNode = function(node, x, y, width, height, noPack) { if (!this.isNodeChangedPosition(node, x, y, width, height)) { return node; } @@ -540,6 +521,10 @@ return node; } + if (!this.isAreaEmpty(x, y, width, height, node)) { + return node; + } + var resizing = node.width != width; node._dirty = true; @@ -555,7 +540,7 @@ node = this._prepareNode(node, resizing); - this._fixCollisions(node, isClone); + this._fixCollisions(node); if (!noPack) { this._packNodes(); this._notify(); @@ -672,6 +657,7 @@ removeTimeout: 2000, verticalMarginUnit: 'px', cellHeightUnit: 'px', + disableOneColumnMode: opts.disableOneColumnMode || false, oneColumnModeClass: opts.oneColumnModeClass || 'grid-stack-one-column-mode', ddPlugin: null }); @@ -768,7 +754,7 @@ self._updateHeightsOnResize(); } - if (self._isOneColumnMode()) { + if (self._isOneColumnMode() && !self.opts.disableOneColumnMode) { if (oneColumnMode) { return; } @@ -782,12 +768,8 @@ if (self.opts.staticGrid) { return; } - if (node.noMove || self.opts.disableDrag) { - self.dd.draggable(node.el, 'disable'); - } - if (node.noResize || self.opts.disableResize) { - self.dd.resizable(node.el, 'disable'); - } + self.dd.draggable(node.el, 'disable'); + self.dd.resizable(node.el, 'disable'); node.el.trigger('resize'); }); @@ -916,6 +898,9 @@ }) .on(self.container, 'dropout', function(event, ui) { var el = $(ui.draggable); + if (!el.data('_gridstack_node')) { + return; + } el.unbind('drag', onDrag); var node = el.data('_gridstack_node'); node.el = null; @@ -931,7 +916,11 @@ node._grid = self; var el = $(ui.draggable).clone(false); el.data('_gridstack_node', node); - $(ui.draggable).remove(); + var originalNode = $(ui.draggable).data('_gridstack_node_orig'); + if (typeof originalNode !== 'undefined' && typeof originalNode._grid !== 'undefined') { + originalNode._grid._triggerRemoveEvent(); + } + $(ui.helper).remove(); node.el = el; self.placeholder.hide(); el @@ -948,9 +937,14 @@ self.container.append(el); self._prepareElementsByNode(el, node); self._updateContainerHeight(); + self.grid._addedNodes.push(node); + self._triggerAddEvent(); self._triggerChangeEvent(); self.grid.endUpdate(); + $(ui.draggable).unbind('drag', onDrag); + $(ui.draggable).removeData('_gridstack_node'); + $(ui.draggable).removeData('_gridstack_node_orig'); }); } }; @@ -1009,6 +1003,8 @@ this._initStyles(); this._updateContainerHeight(); } + this._initStyles(); + this._updateContainerHeight(); if (!this.opts.cellHeight) { // The rest will be handled by CSS return ; } @@ -1114,9 +1110,6 @@ }; GridStack.prototype._prepareElementsByNode = function(el, node) { - if (typeof $.ui === 'undefined') { - return; - } var self = this; var cellWidth; @@ -1134,20 +1127,32 @@ } if (event.type == 'drag') { - if (x < 0 || x >= self.grid.width || y < 0 || (self.grid.height && y >= self.grid.height)) { - if (self.opts.removable === true) { - self._setupRemovingTimeout(el); + var cannotPutHere = !self.isAreaEmpty(x, y, node.width, node.height, node), + whatIsHere; + + if (cannotPutHere) { + whatIsHere = self.grid.whatIsHere(x, y, node.width, node.height); + if (whatIsHere && whatIsHere.length === 1 && whatIsHere[0].el === this.placeholder) { + cannotPutHere = false; } + } - x = node._beforeDragX; - y = node._beforeDragY; + if (cannotPutHere) { + if (!node._temporaryRemoved) { + if (self.opts.removable === true) { + self._setupRemovingTimeout(el); + } - self.placeholder.detach(); - self.placeholder.hide(); - self.grid.removeNode(node); - self._updateContainerHeight(); + x = node._beforeDragX; + y = node._beforeDragY; - node._temporaryRemoved = true; + self.placeholder.detach(); + self.placeholder.hide(); + self.grid.removeNode(node); + self._updateContainerHeight(); + + node._temporaryRemoved = true; + } } else { self._clearRemovingTimeout(el); @@ -1217,6 +1222,10 @@ if (event.type == 'resizestart') { o.find('.grid-stack-item').trigger('resizestart'); } + + if (typeof self.opts.draggable.start === 'function') { + self.opts.draggable.start(event, ui); + } }; var onEndMoving = function(event, ui) { @@ -1232,6 +1241,8 @@ if (node._isAboutToRemove) { forceNotify = true; + var gridToNotify = el.data('_gridstack_node')._grid; + gridToNotify._triggerRemoveEvent(); el.removeData('_gridstack_node'); el.remove(); } else { @@ -1266,6 +1277,10 @@ $(el).data('gridstack').onResizeHandler(); }); o.find('.grid-stack-item').trigger('resizestop'); + o.find('.grid-stack-item').trigger('gsresizestop'); + } + if (event.type == 'resizestop') { + self.container.trigger('gsresizestop', o); } }; @@ -1281,11 +1296,11 @@ resize: dragOrResize }); - if (node.noMove || this._isOneColumnMode() || this.opts.disableDrag) { + if (node.noMove || (this._isOneColumnMode() && !self.opts.disableOneColumnMode) || this.opts.disableDrag) { this.dd.draggable(el, 'disable'); } - if (node.noResize || this._isOneColumnMode() || this.opts.disableResize) { + if (node.noResize || (this._isOneColumnMode() && !self.opts.disableOneColumnMode) || this.opts.disableResize) { this.dd.resizable(el, 'disable'); } @@ -1298,11 +1313,12 @@ el = $(el); el.addClass(this.opts.itemClass); - var node = self.grid.addNode({ - x: el.attr('data-gs-x'), - y: el.attr('data-gs-y'), - width: el.attr('data-gs-width'), - height: el.attr('data-gs-height'), + + var props = { + x: parseInt(el.attr('data-gs-x'), 10), + y: parseInt(el.attr('data-gs-y'), 10), + width: parseInt(el.attr('data-gs-width'), 10), + height: parseInt(el.attr('data-gs-height'), 10), maxWidth: el.attr('data-gs-max-width'), minWidth: el.attr('data-gs-min-width'), maxHeight: el.attr('data-gs-max-height'), @@ -1311,10 +1327,28 @@ noResize: Utils.toBool(el.attr('data-gs-no-resize')), noMove: Utils.toBool(el.attr('data-gs-no-move')), locked: Utils.toBool(el.attr('data-gs-locked')), + resizeHandles: el.attr('data-gs-resize-handles'), el: el, id: el.attr('data-gs-id'), _grid: self - }, triggerAddEvent); + }; + + if (!this.isAreaEmpty(props.x, props.y, props.width, props.height)) { + var freeSpace = this.findFreeSpace(props.width, props.height); + if (!freeSpace) { + freeSpace = this.findFreeSpace(1, 1); + } + if (freeSpace) { + props.x = freeSpace.x; + props.y = freeSpace.y; + props.width = freeSpace.w; + props.height = freeSpace.h; + } else { + return; + } + } + + var node = self.grid.addNode(props, triggerAddEvent); el.data('_gridstack_node', node); this._prepareElementsByNode(el, node); @@ -1417,7 +1451,7 @@ } node.noResize = !(val || false); - if (node.noResize || self._isOneColumnMode()) { + if (node.noResize || (self._isOneColumnMode() && !self.opts.disableOneColumnMode)) { self.dd.resizable(el, 'disable'); } else { self.dd.resizable(el, 'enable'); @@ -1438,7 +1472,7 @@ } node.noMove = !(val || false); - if (node.noMove || self._isOneColumnMode()) { + if (node.noMove || (self._isOneColumnMode() && !self.opts.disableOneColumnMode)) { self.dd.draggable(el, 'disable'); el.removeClass('ui-draggable-handle'); } else { @@ -1673,8 +1707,8 @@ this._updateContainerHeight(); }; - GridStack.prototype.isAreaEmpty = function(x, y, width, height) { - return this.grid.isAreaEmpty(x, y, width, height); + GridStack.prototype.isAreaEmpty = function(x, y, width, height, exceptNode) { + return this.grid.isAreaEmpty(x, y, width, height, exceptNode); }; GridStack.prototype.findFreeSpace = function(w, h) {