Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
ngx-mega-simple-drag-drop-list
Advanced tools
Readme
Angular 2/3/4/5/6/7 Drag Drop Simple Reordable List Items
*had to photoshop the little dragging cursor. Guess it will look different in different OS's and browsers
https://ives.me/NgxMegaSimpleDragDropListDemoWithNpmPackage/
npm i ngx-mega-simple-drag-drop-list
app.module.ts
import { NgxMegaSimpleDragDropListModule } from 'ngx-mega-simple-drag-drop-list';
@NgModule({
imports: [
NgxMegaSimpleDragDropListModule
],
})
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
items = [1, 2, 3, 4, 5];
constructor() { }
ngOnInit() {}
onDropped(newItems) {
this.items = newItems;
}
}
app.component.html
<div class="card" *ngFor="let item of items;let index = index;" megaSimpleDndList [items]="items" [index]="index" (dropped)="onDropped($event)">
<div class="card-content">
{{item}}
</div>
</div>
app.component.css
.card {
cursor: move;
float: left;
position: relative;
margin: .5rem 1rem 1rem 0;
background-color: #fff;
transition: box-shadow opacity .25s;
border-radius: 2px;
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.2);
}
.card .card-content{
pointer-events: none; /*make sure you add this to all card children. This ensures only the card is dragged*/
padding: 40px;
border-radius: 0 0 2px 2px;
font-size: 30px;
text-align: center;
}
.hover {
box-shadow: 0px 0px 25px 0px rgba(0,0,0,0.75);
}
.draggin {
opacity: 0.4;
}
Input | Type | Default | Required | Description |
---|---|---|---|---|
items | array | any[] | yes | Array to reorder |
index | number | null | yes | Index of the current element |
hoverStyle | string | hover | no | Css class name when hovering |
dragStyle | string | draggin | no | Css class name when dragging the element |
isSwap | boolean | false | no | Controls if you want to swap items in the array or reorder the whole array |
Output | Type | Description |
---|---|---|
(dropped) | array | Returns the array |
FAQs
Angular 2/3/4/5/6/7 Drag Drop Simple Reordable List Items
The npm package ngx-mega-simple-drag-drop-list receives a total of 175 weekly downloads. As such, ngx-mega-simple-drag-drop-list popularity was classified as not popular.
We found that ngx-mega-simple-drag-drop-list demonstrated a not healthy version release cadence and project activity because the last version was released 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.