• Stars
    star
    574
  • Rank 77,739 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ•Ά Drag, Drop and Sorting Library for Angular2 and beyond!

ngx-dnd

Codacy Badge npm downloads

πŸ•Ά Drag, Drop and Sorting Library for Angular6 and beyond!

Note: The drag-and-drop directives in angular/cdk are great. Use that if you don't need nested DnD containers. We are investigating using angular/cdk directives internally

Features

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

Install

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

  • npm i @swimlane/ngx-dnd @swimlane/dragula @types/dragula --save
  • Add NgxDnDModule.forRoot() to your application module.
  • If using directives you will need to BYO styles or include @swimlane/ngx-dnd/release/index.css.
  • You may need to add the following to your polyfills.ts file:
if (typeof window['global'] === 'undefined') {
  window['global'] = window;
}

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 [model]="item" *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/src/.

Development

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

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

  • Checkout master (git checkout master)
  • Pull master (git pull)
  • Clean and test (Optional)
    • Run rm -rf node_modules
    • Run npm i
    • Run tests (npm run test:ci)
  • Examine CHANGELOG.md to determine next version (X.Y.Z)
  • Run git checkout -b release/X.Y.Z
  • Update version using npm version [<newversion> | major | minor | patch]
    • This will update package.json versions and changelog.md.
  • Run git push origin HEAD --tags
  • Run npm run publish:lib
  • Run npm run deploy
  • Submit PR

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.

More Repositories

1

ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
TypeScript
4,625
star
2

ngx-charts

πŸ“Š Declarative Charting Framework for Angular
TypeScript
4,285
star
3

ngx-graph

Graph visualization library for angular
TypeScript
927
star
4

ngx-ui

πŸš€ Style and Component Library for Angular
TypeScript
705
star
5

angular-data-table

A feature-rich but lightweight ES6 AngularJS Data Table crafted for large data sets!
JavaScript
577
star
6

pyattck

A Python package to interact with the Mitre ATT&CK Framework
Python
468
star
7

node-microservice-demo

✨ Example project for Micro-services w/ Node + TypeScript + Express + Swagger + Docker
TypeScript
446
star
8

angular-model-factory

angular-model-factory makes working with RESTful APIs in AngularJS easy!
JavaScript
230
star
9

angular1-systemjs-seed

AngularJS 1.x + SystemJS Seed
JavaScript
210
star
10

elk-tls-docker

This repository contains code to create a ELK stack with certificates & security enabled using docker-compose
Python
183
star
11

soc-faker

A python package for use in generating fake data for SOC and security automation.
Python
158
star
12

atomic-operator

A Python package is used to execute Atomic Red Team tests (Atomics) across multiple operating system environments.
Python
136
star
13

trafficlight

🚦 Flexible NodeJS Routing Decorators for API Routing
TypeScript
73
star
14

mongtype

πŸš€ MongoDB Repository Pattern for Node written in TypeScript
TypeScript
65
star
15

ng1-ng4-webpack-lazy-uirouter

😁 Angular1 + Angular4 + Webpack2 + UI-Router + Lazy Loading + Babel
JavaScript
55
star
16

DocSPA

A documentation SPA in Angular.
TypeScript
46
star
17

coconspirators

πŸ“ž Microservice framework for RabbitMQ written in TypeScript
TypeScript
43
star
18

systemjs-route-bundler

SystemJS Route-Driven Bundler
JavaScript
41
star
19

PSAttck

PSAttck is a light-weight framework for the MITRE ATT&CK Framework.
PowerShell
38
star
20

trawl

A utility to trawl phishing domains and attempt to identify phishing kits as well as other malicious activity
Python
36
star
21

pyews

A Python package to interact with the both on-premises and Office 365 Exchange Web Services
Python
32
star
22

swimlane-python

🐍 Official Python client for the Swimlane API
Python
32
star
23

ngx-cron

πŸ•’ User-friendly cron input...
TypeScript
32
star
24

qswag

Fast & Light Swagger generator for .NET Core
C#
28
star
25

ngx-charts-builder

πŸš€ Chart Builder for ngx-charts!
TypeScript
26
star
26

graphish

A Python package to search & delete messages from mailboxes in Office 365 using Microsoft Graph API
Python
25
star
27

makobot

🚨 Slack bot for cyber-security phishing
Python
21
star
28

el-segundo

πŸ’© I don't always do dirty checking, but when I do, I use El Segundo.
JavaScript
20
star
29

python-office365

πŸ’Ό Office 365 REST API wrapper. Strongly typed.
Python
19
star
30

swagger-changelog

Generate a changelog between two versions of a swagger spec
JavaScript
17
star
31

pyattck-data

This repository contains generated contextual data utilized by pyattck.
Python
17
star
32

cy-mockapi

Easily mock your REST API in Cypress using fixtures
TypeScript
16
star
33

CLAW

A packer utility to create and capture DFIR Image for use AWS & Azure
Shell
14
star
34

PSCVSS

A Windows PowerShell & PowerShell Core Module to calculate a CVSS3 Score based on a Vector string
PowerShell
12
star
35

pkgdrop

Easy deployment of ES modules without external connection needed at runtime
TypeScript
12
star
36

deepdive-domain-data

This repository contains data related to coronavirus & COVID-19 based domains identified by Swimlane's DeepDive research team
Python
11
star
37

ng-context-menu

Originally ianwalter/ng-context-menu
JavaScript
11
star
38

ngx-charts-dashboard

TypeScript
10
star
39

cy-dom-diff

Allows matching chunks of DOM against HTML; including dynamic content.
TypeScript
9
star
40

gulp-dotnet

GulpJS plugin for DOTNET Core that builds, starts and updates
JavaScript
7
star
41

obfuscator

πŸ— Obfuscate values based on JSON Schemas
TypeScript
6
star
42

swinger

Swagger aggregation for microservices
TypeScript
5
star
43

lint-rules

A collection of lint rules used in Swimlane Development Projects πŸ“πŸΌ
4
star
44

rql-to-mongo

TypeScript
4
star
45

ews-builder

A Python package to build EWS SOAP request bodies from EWS WSDL
Python
3
star
46

atomic-operator-runner

A Python package used to run code remotely.
Python
3
star
47

blog-resources

This repository contains examples and references used by Swimlane Security Research Engineering
PowerShell
3
star
48

attck

This repository contains documentation for pyattck & PSAttck
JavaScript
2
star
49

prettier-config-swimlane

πŸ’„ Prettier configuration used in Swimlane projects.
JavaScript
2
star
50

R4T4

Roslyn code dom provider for T4 templates
C#
2
star
51

swimlane-learnupon

A python package for interacting with the LearnUpon LMS
Python
2
star
52

pyattck-data-models

A Python package containing data models for pyattck
Python
2
star
53

sw_sixgill_darkfeed

Python
2
star
54

turbine-environment-validator

Turbine Environment Validator
Python
1
star
55

sw_sixgill_dve_enrich

Python
1
star
56

swimmy

Swimmy is a Slack bot to interact with a Swimlane instance
Python
1
star
57

rabbitmq-docker

1
star
58

splunkapi3

Splunk API for Python 3.5
Python
1
star
59

docspa-starter

TypeScript
1
star
60

orient-client

Swimlane fork of OrientDB Client
C#
1
star
61

docker-login-tag-push-action

Github action for republishing docker image to a different repository,
1
star
62

prettier-setup

πŸ’… A CLI tool for adding Prettier to projects.
JavaScript
1
star
63

sw_sixgill_dvefeed_ingestion

Python
1
star
64

sla_calculator

A python module that will calculate the sla time based on working hours and holidays.
Python
1
star
65

sw_sixgill_actionable_alerts

Python
1
star
66

swimlane-environment-validator

Python
1
star
67

techpubs-knowledgecenter

HTML
1
star
68

eslint-config

Rules for eslint used in Swimlane's Javascript (etc) development.
JavaScript
1
star