npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@libria/gridstack

v9.0.1

Published

Angular 8 wrapper for gridstack.js

Downloads

403

Readme

lb-gridstack

Angular 9 wrapper for Gridstack.js.

Getting started

npm install @libria/gridstack --save

Then import the library on your root module (AppModule, for instance):

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';


import { AppComponent } from './app.component';
import { GridstackModule } from '@libria/gridstack';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    GridstackModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Since this library is a wrapper for a jquery plugin, you need to define some global plugins and styles.

Using Angular-cli:

  • Add the following to the .angular.json file
{
  ...,
  "apps": [{
    ...
    "styles": [
        "../node_modules/gridstack/dist/gridstack.css",
        ...
    ],
    "scripts": [
        "../node_modules/lodash/lodash.min.js",
        "../node_modules/jquery/dist/jquery.min.js",
        "../node_modules/jquery-ui-dist/jquery-ui.js",
        "../node_modules/gridstack/dist/gridstack.js",
        "../node_modules/gridstack/dist/gridstack.jQueryUI.js",
        ...
    ],
  }]
}

Basic library usage

<div lb-gridstack
     width="5">
    <div lb-gridstack-item
         x="0"
         y="0"
         width="3">
        Widget 1
    </div>
    <div lb-gridstack-item
         x="3"
         y="0"
         width="2">
        Widget 2
    </div>
</div>

Options

All attribute options match the gridstack.js data-gs-* attributes unless explicitly stated.

lb-gridstack

| Name | Description | Additional Information | | --- | --- | --- | | options | general options for the grid. See https://github.com/gridstack/gridstack.js/tree/master/doc#options | The option 'acceptWidgets' is not fully supported yet | | animate | turns animation on | - | | width | amount of columns | The library supports up to 24 columns without having to manually change the CSS | | height | maximum rows amount | - |

lb-gridstack-item

| Name | Description | Additional Information | | --- | --- | --- | | id | good for quick identification | - | | x | element position | - | | y | element position | - | | width | element size | - | | height | element size | - | | max-width | element size constraint | - | | max-height | element size constraint | - | | min-width | element size constraint | - | | min-height | element size constraint | - | | no-resize | disable element resizing | - | | no-move | disable element moving | - | | auto-position | tells to ignore data-gs-x and data-gs-y attributes and to place element to the first available position | - | | 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. | - |