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

@tommueller/ngx-widget-grid

v2.0.9

Published

An angular 2.0+ module for widget-grids to be used for dashboard

Downloads

4

Readme

ngx-widget-grid

codebeat badge

A flexible grid layout for responsive dashboards

This library got its inspiration from angular-widget-grid and has been written as a pure Angular 2.x [+] module.

Demo: https://envyn.github.io/ngx-widget-grid

Installation

Install with npm:

$ npm install ngx-widget-grid

Add the ngx-widget-grid module as a dependency to your application module:

import { NgxWidgetGridModule } from 'ngx-widget-grid/dist';

@NgModule({
  declarations: [
    ...
  ],
  imports: [
    ...
    NgxWidgetGridModule,
    ...
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

If using SystemJS add this to systemJS config:

packages: {
    ...
    'ngx-widget-grid/dist': {main: 'bundles/ngx-widget-grid.umd.js', defaultExtension: 'js'},
    ...
}

Usage

Minimal Example

<ngx-widget-grid [rows]="4" [columns]="5" [highlightNextPosition]="false"
                 [showGrid]="true" (widgetPositionChange)="onWidgetChange($event)">
  <ngx-widget [(position)]="{top: 2,left: 2,height: 1,width: 1}"
              [movable]="true" [resizable]="true">
    <div style="height:100%;width:100%; display:flex;">
      <div style="height:100%;width:100%; padding:10px; background-color: rgb(140, 198, 0);">
      </div>
    </div>
  </ngx-widget>
</ngx-widget-grid>

Minimal Example

Adding Traits

Widgets

position
<ngx-widget [(position)]="widget.position"...>

You can bind the position of the widget to data received from server so that even if the widget is moved, the new positions are always updated in the widget configuration.

movable
<ngx-widget [movable]="true" [(position)]="widget.position"...>

If movable is true, users will be able to move the respective widget.

Moving Widgets

resizable
<ngx-widget [resizable]="true" [(position)]="widget.position"...>

If resizable is true, users will be able to resize the respective widget.

Resizing Widgets

Optionally, you can limit the resize directions:

<ngx-widget [resizeDirections]="['NW', 'NE', 'E', 'SW']" [(position)]="widget.position"...>

Restricted Resizing

Grid: Options

showGrid (default: false)
<ngx-grid columns="20" rows="15" [showGrid]="true">

Toggles the gridlines.

Gridlines Enabled

highlightNextPosition (default: false)
<ngx-grid columns="20" rows="15" [highlightNextPosition]="true">

Highlights the largest free area in the grid, if any. This area will be automatically assigned to the next widget with a falsy or conflicting position.

Highlight Next Position (1/2) Highlight Next Position (2/2)

Events

gridFull

The grid emits gridFullevent as true (when grid has been fully occupied) or false when there is still some space left in the grid, so that you can e.g. enable/disable UI elements accordingly.

<ngx-grid columns="20" rows="15" (gridFull)="onGridFull($event)">
function onGridFull(isGridFull) {
    if(isGridFull){
        ...
        //make add widget button disabled
        ...
    }else{
        ...
        //make add widget button enabled
        ...
    }
}
widgetPositionChange

Emitted whenever the position of a widget is changed. The event comes with an attached object argument, which contains the affected widget's index and its newPosition.

<ngx-grid columns="20" rows="15" (widgetPositionChange)="onWidgetChange($event)">

Functions

getNextPosition

getNextPosition is a function you could call to get details about the next available position that is being highlighted as part of highlightNextPosition.

Build

Check out /src for the original source code.

License

MIT