Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@ks89/ngx-drag-n-drop
Advanced tools
Based on angular4-drag-drop, but with support for Angular >=7 and other improvements.
angular-cli
npm install --save @ks89/ngx-drag-n-drop
@ks89/ngx-drag-n-drop | |
---|---|
AngularJS | NOT WORKING |
Angular 2 | NOT OFFICIALLY SUPPORTED |
Angular 4 | NOT OFFICIALLY SUPPORTED |
Angular 5 | NOT OFFICIALLY SUPPORTED |
Angular 6 | NOT OFFICIALLY SUPPORTED |
Angular 7 | >= 1.0.0 and <2.0.0 |
Angular 8 | >= 1.0.0 and <2.0.0 |
Angular 9 | >= 2.0.0 and <3.0.0 |
Angular 10 | >= 3.0.0 and <4.0.0 |
Angular 11 | >= 3.0.0 and <4.0.0 |
Angular 12 | >= 4.0.0 |
Angular 13 | >= 5.0.0 |
Angular 14 | >= 5.0.0 |
Angular 15 | >= 6.0.1 |
Angular 16 | >= 7.0.0 |
Angular 17 | >= 7.0.0 |
Angular 18 | >= 8.0.0 |
To import the module into a module in which you wish to use the directive on components.
import { DragDropDirectiveModule} from "@ks89/ngx-drag-n-drop";
This module exports two attribute directives, 'DragDirective' and 'DropDirective'. DragDirectve is used with a component from which you want to drag items, while DropDirective is used with the component in which you wish to drop items.
Both accept inputs for CSS class highlighting. If you do not pass a string then highlighting will be ignored. Both will emit the dragged item when it is dropped in the 'DroppableDirective' component or element.
'DragDirective' emits an event when dragging is started.
'DropDirective' emits events when a drag enters a drop element, leaves a drop element, and as stated above when an element is dropped.
<div *ngFor="let item of itemsToDrop" ksDragDirective [draggedItem]='item' [dragHightlight]="'highlight'" (releaseDrop)="releaseDrop($event)" (startDrag)="startDrag(item)">
</div>
'[draggedItem]="item"' Applies the drag directive, and passes it an item.
'[dragHighlight]="'highlight'"' Passes a string to add a css class to the css class list of the element.
'(releaseDrop)="releaseDrop($event)"' Calls a function to act on the dragged item once it is dropped into the drop area.
'(startDrag)="startDrag(item)" Calls a function when the user starts dragging the item.
<div ksDropDirective (dropEvent)="addDropItem($event)" (dropEventMouse)="dropEventMouse($event) (dragenterEvent)="dragEnter($event)" (dragleaveEvent)="dragLeave()" class="droppable" [dropHighlight]="'highlight'" >
</div>
'ksDropDirective' applies the directive to an element, making it a drop target. '[dropHighlight]="'highlight'"' passes a string to add a css class to the css class list of the element.
'(dropEvent)="addDropItem($event)"' calls a function and passes the dropped item when an item is dropped into the drop element.
'(dropEventMouse)="dropEventMouse($event)"'. dropEventMouse is emitting the html drop event. From this you can get x,y cordinates of the drop etc. If you wish you can use this to get the dropped item as well: let droppedObject = JSON.parse(event.dataTransfer.getData('text')).
'(dragenterEvent)="dragEnter($event)"' calls a function and passes the dragged item when an item is dragged into the drop element.
'(dragleaveEvent)="dragLeave($event)"' calls a function and passes the dragged item when the item is dragged out of the drop element.
Check CONTRIBUTING.md
in this repository.
To understand how to contribute to an open source project, HERE you can find useful information.
When you create a pull request, please, format your code to be consistent with the existing code. I suggest to use WebStorm as IDE and when you commit don't use a third party software, but the official command line git
.
In this way, prettier will run using my configuration and it will auto-format the code. If it will fail, add files with git add .
again and retry.
The MIT License (MIT)
Copyright (c) 2019-2024 Stefano Cappa (Ks89)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Created by Stefano Cappa
FAQs
Drag and drop library for Angular
The npm package @ks89/ngx-drag-n-drop receives a total of 327 weekly downloads. As such, @ks89/ngx-drag-n-drop popularity was classified as not popular.
We found that @ks89/ngx-drag-n-drop demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.