Code Monkey home page Code Monkey logo

gridstack's Introduction

Published on Vaadin  Directory Stars on Vaadin Directory

GridStack Add-on for Vaadin

This add-on provides GridStackLayout layout component that uses gridstack.js on client side.

Build Status

Code example

As code is in experimental stage, please check the DemoUI class.

Online demo

Try the add-on demo at http://app.siika.fi/GridStackDemo

FAQ

Width of GridStackLayout has to be defined

If you are experiencing issues with GridStackLayout, first check if it's width has been defined. Almost always correct way to do is to set it to relative 100%.

gridstack.setWidth(100, Unit.PERCENTAGE);

More than 8 columns in GridStackLayout are not sized correctly

As part of sizing is done in CSS, in case of more than 8 columns you must:

Add unique stylename to your layout:

GridStackLayout gridstack = new GridStackLayout(12);
gridstack.addStyleName("my-gridstacklayout");

Then in scss of your theme, add rule:

.grid-stack.my-gridstacklayout {
   @include gridstacklayout-columns(12);
}

After this you should have all 12 columns sized correctly to take 8.333...% of width.

Using separate dragging handle

You can define if dragging is done from separate dragging handle or from the whole component. Using the whole child component as dragging handle can have issues with some components (eg. Buttons).

// Adding component with dragging handle (default behavior)
gridstack.addComponent(myLayout);

// Adding component without dragging handle (content acts as dragging handle)
gridstack.addComponent(myLabel, false);

Using Button without separate dragging handle

Replace your Buttons with GridStackButtons. This modifies client side implementation to prevent dragging issues.

Button button = new GridStackButton("My Button");
//... continue using as normal button ... 

Download release

Official releases of this add-on are available at Vaadin Directory. For Maven instructions, download and reviews, go to http://vaadin.com/addon/gridstack

Release notes

Version 0.4.2 (TBD)

  • Mark listeners serializable
  • Upgrade gridstack.js to 1.0.0-dev and jQuery to 3.2.1
  • Code fix from https://github.com/olafj

Version 0.4.1 (2017-06-21)

  • Add method to set style name for item wrapper
  • Alternative paper styling from Masonry add-on
  • gridstack-initializing and gridstack-ready stylenames added to allow advanced theming

Version 0.4.0 (2017-03-14)

  • Ready event has now easy way to verify it's called first time for that GridStackLayout
  • Vaadin 8 supported and required
  • gridstack.js updated to 0.3.0-dev
  • Found out that min-height: 100%; is bad idea to have on grid-stack element, so removed it from demo app. Now resizing and dragging works better.
  • Move to use Vaadin Icons, as it's part of Valo in Vaadin 8
  • Minor fixes done in initial rendering

Version 0.3.2 (2016-08-07)

  • Uses CamelCase methods and variables, to avoid deprecated warnings on client side
  • Fix initialization issue when adding GridStack to parent existing on client
  • Improving performance and error management in add-on's code
  • With complex DOM structures in children gridstack.js initializing gets slow. To fight this ready listener interface is added. It seams to be faster to add children after gridstack.js has initialized itself, than adding those before initialization. To use this trick add GrisStackReadyListener and add child components only when it's called. As extra benefit event will tell the width of component on client side. This can used to adjust the layout.

Version 0.3.1 (2016-07-20)

  • isAreaEmpty will now return false if area goes outside the right edge of layout
  • Client side now calls gridstack.js for it's children based on order of coordinates. Issue #18

Version 0.3.0 (2016-05-18)

  • Possibility to move and resize already added children
  • Adds animate option to allow nice transitions when moving children
  • gridstack.js updated to 0.2.5
  • Deprecated API removed
  • Fix error in getComponent method with coordinates (could have returned wrong components)

Version 0.2.1 (2015-12-23)

  • Add missing API to define cell height, min width and vertical margins
  • API to set wrappers un-scrollable
  • GridStackButton component added if you want to use Button without separate draghandle

Version 0.2.0 (2015-11-30)

  • Fixing issue #3 "Removing and subsequently adding Components"
  • Clearning unneeded error debug prints on client side
  • Way Vaadin components handle events cause issues with gridstack's drag handling. For this reason separate drag handle element is now used by default. Issue #2
  • Adding top level static option to toggle layout's edit mode. Currently still allows to drag children that allow dragging without handle (KNOWN ISSUE).

Version 0.1.0 (2015-11-09)

  • Initial release. Not all features supported yet, but should allow basic usage

Roadmap

  • Touch device support will require extra dependency and testing

This component is developed as a hobby with no public roadmap or any guarantees of upcoming releases. That said, the following features are planned for upcoming releases:

  • Adding missing functionality of gridstack.js to server side API

Issue tracking

The issues for this add-on are tracked on its github.com page. All bug reports and feature requests are appreciated.

Contributions

Contributions are welcome, but there are no guarantees that they are accepted as such. Process for contributing is the following:

  • Fork this project
  • Create an issue to this project about the contribution (bug or feature) if there is no such issue about it already. Try to keep the scope minimal.
  • Develop and test the fix or functionality carefully. Only include minimum amount of code needed to fix the issue.
  • Refer to the fixed issue in commit
  • Send a pull request for the original project
  • Comment on the original issue that you have implemented a fix for it

Building and running demo

git clone https://github.com/alump/GridStack.git mvn clean install cd demo mvn jetty:run

To see the demo, navigate to http://localhost:8080/

Licenses & Authors

Vaadin add-on and integration

Apache License 2.0, Sami Viitanen, http://github.com/alump/GridStack

gridstack.js

MIT License, Pavel Reznikov, https://github.com/troolee/gridstack.js

lodash.js

https://github.com/lodash/lodash/blob/master/LICENSE, The Dojo Foundation, https://github.com/lodash/lodash

jQuery UI

MIT License, The jQuery Foundation and other contributors, https://jqueryui.com/

jQuery

https://github.com/jquery/jquery/blob/master/LICENSE.txt, The jQuery Foundation and other contributors

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.