Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
@swimlane/ngx-dnd
Advanced tools
🕶 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
To use ngx-dnd in your project install it via npm:
npm i @swimlane/ngx-dnd @swimlane/dragula @types/dragula --save
NgxDnDModule.forRoot()
to your application module.@swimlane/ngx-dnd/release/index.css
.polyfills.ts
file:if (typeof window['global'] === 'undefined') {
window['global'] = window;
}
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>
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/.
git clone git@github.com:swimlane/ngx-dnd.git
cd ngx-dnd
ng build @swimlane/ngx-dnd
ng serve
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.
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.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.
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.
git checkout master
)git pull
)rm -rf node_modules
npm i
npm run test:ci
)git checkout -b release/X.Y.Z
npm version [<newversion> | major | minor | patch]
package.json
versions and changelog.md
.git push origin HEAD --tags
npm run publish:lib
npm run deploy
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.
FAQs
Drag and Drop for Angular2 and beyond!
The npm package @swimlane/ngx-dnd receives a total of 5,017 weekly downloads. As such, @swimlane/ngx-dnd popularity was classified as popular.
We found that @swimlane/ngx-dnd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 41 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.