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

@wandererin/ngx-dnd

v4.1.0

Published

Drag and Drop for Angular2 and beyond!

Downloads

6

Readme

ngx-dnd Codacy Badge

🕶 Drag, Drop and Sorting Library for Angular4 and beyond!

Note: This project is under heavy construction. As such, the API may change dramatically between major releases and documentation is lacking.

Features

  • Drag and Drop
  • Sorting
  • Events (drag, drop, over, out)
  • Nesting
  • Touch support
  • Templating

Quick intro and examples

Directives

ngx-dnd provides a base set of directives to enable drag-and-drop. By default all children of a ngxDroppable element may be dragged and dropped. Add the ngxDraggable to restrict drag-and-drop to the parent container. In general prefer using the base directives to the help components introduced later.

<div class="ngx-dnd-container" ngxDroppable>
  <div class="ngx-dnd-item" ngxDraggable>Item 1</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 2</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 3</div>
</div>

Give multiple containers the same dropZone name to allow drag-and-drop between these containers.

<div class="ngx-dnd-container" ngxDroppable="example">
  <div class="ngx-dnd-item" ngxDraggable>Item 1a</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 2a</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 3a</div>
</div>
<div class="ngx-dnd-container" ngxDroppable="example">
  <div class="ngx-dnd-item" ngxDraggable>Item 1b</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 2b</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 3b</div>
</div>

ngxDraggable items can be restricted to specific containers:

<div class="ngx-dnd-container" ngxDroppable>
  <div class="ngx-dnd-item" ngxDraggable="['example-target']">Item 1a</div>
  <div class="ngx-dnd-item" ngxDraggable="['example-target']">Item 2a</div>
  <div class="ngx-dnd-item" ngxDraggable="['example-target']">Item 3a</div>
</div>
<div class="ngx-dnd-container" ngxDroppable="example-target">
  <div class="ngx-dnd-item" ngxDraggable>Item 1b</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 2b</div>
  <div class="ngx-dnd-item" ngxDraggable>Item 3b</div>
</div>

Components

ngx-dnd provides a set of helper components that encapsulates the directives mentioned and adds capability for data driven structures. In general you should prefer directives to components.

orderableLists = [
  [
    "Item 1a",
    "Item 2a",
    "Item 3a"
  ],
  [
    "Item 1b",
    "Item 2b",
    "Item 3b"
  ]
]
<ngx-dnd-container
  [model]="orderableLists">
</ngx-dnd-container>

This component is effectively equivalent to:

<div class="ngx-dnd-container" ngxDroppable [model]="orderableLists">
  <div
    class="ngx-dnd-item"
    ngxDraggable
    *ngFor="let item of orderableLists">{{item}}</div>
</div>

Including nested containers:

<ngx-dnd-container
  [model]="nestedLists">
</ngx-dnd-container>
nestedLists = [
  {
    "label": "Item 1",
    "children": []
  },
  {
    "label": "Item 2",
    "children": [
      {
        "label": "Item 2a",
        "children": []
      },
      {
        "label": "Item 2b",
        "children": []
      },
      {
        "label": "Item 2c",
        "children": []
      }
    ]
  },
  {
    "label": "Item 3",
    "children": [
      {
        "label": "Item 3a",
        "children": []
      },
      {
        "label": "Item 3b",
        "children": []
      },
      {
        "label": "Item 3c",
        "children": []
      }
    ]
  }
]

See https://swimlane.github.io/ngx-dnd/ for more lives examples. Demo code is at https://github.com/swimlane/ngx-dnd/tree/master/demo.

Install

To use ngx-dnd in your project install it via npm:

  • npm i @swimlane/ngx-dnd --save
  • Add NgxDnDModule to your application module
  • If using directives you will need to BYO styles or include @swimlane/ng-dnd/release/lib/ngx-dnd.css.

Development

  • git clone [email protected]:swimlane/ngx-dnd.git
  • cd ngx-dnd
  • npm install
  • npm start
  • Browse to http://localhost:9999

CHANGELOG

This project uses heff/chg, a simple changelog/release history manager. When contributing to this project please add change notes (manually or using the heff/chg cli) to the ## HEAD (Unreleased) section.

Release

This project uses sindresorhus/np, a better npm publish. To publish a new version to npm, first ensure all entries in the ## HEAD (Unreleased) section of the changelog are appropriate, commit changes, and push changes to github (if not already done). Then use npm run np to launch an interactive UI that will guide you through publishing a new version. sindresorhus/np and heff/chg will perform various pre-publish checks, run tests, bump the version number, update the changelog, then publish to npm and push to github.

  • rm -rf node_modules
  • npm i
  • npm test
  • update version in package.json
  • Update CHANGELOG.md:
    • move entries in the ## HEAD (Unreleased) section below the horizontal rule, under a new header with the version number.
    • ensure all entries are approprate.
    • Leave a single * _(none)_ entry in the ## HEAD (Unreleased) section.
  • git commit -am {VERSION NUMBER}
  • git tag {VERSION NUMBER}
  • git push --tags
  • npm run package
  • npm publish

Credits

ngx-dnd is a Swimlane open-source project; we believe in giving back to the open-source community by sharing some of the projects we build for our application. Swimlane is an automated cyber security operations and incident response platform that enables cyber security teams to leverage threat intelligence, speed up incident response and automate security operations.