Coder Social home page Coder Social logo

kutlugsahin / ngx-smooth-dnd Goto Github PK

View Code? Open in Web Editor NEW
165.0 165.0 29.0 9.48 MB

angular wrapper for smooth-dnd

TypeScript 74.19% HTML 6.34% CSS 18.38% JavaScript 1.09%
angular angular5 dnd drag drag-and-drop draggable drop smooth-dnd sortable

ngx-smooth-dnd's People

Contributors

kutlugsahin avatar ne4istb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ngx-smooth-dnd's Issues

Dynamically removing items from array seems to bug the sorting

This is probably me doing something wrong but I can't figure how to properly do this. I just want to remove an item from the array which I assumed was as simple as

disableItem(item: any) {
    item.isEnabled = false;
    const index = this.enabledItems.indexOf(item);
    this.enabledItems.splice(index, 1);
  }

Unfortunately this seems to bug the ordering when dropping the FIRST element, it returns to normal after that. Below is a picture illustrating the behaviour.

image

Here is a very small stackblitz where you can reproduce the problem: https://stackblitz.com/edit/angular-exjr9b

Repro steps:

  • Click on the X button for Obj 2, 3 and 4 from the right group

  • Drag Obj2 from the left group into the right group, don't release/drop yet

  • Drag Obj2 up and down the right list to reproduce a weird behaviour.

  • Drop Obj 2 anywhere on the right list

  • Drag Obj 3 and try to reproduce the same behaviour. It appears to be okay

This is probably something extremely simple that I'm just missing out. If you could point out the solution I'd appreciate it.

Licence

Hi, I would like to tell you that you did a great work! The most awesome thing is animations.
But there's one problem/issue with license. I have not found any seperate license file nor license setting in your package.json file.
So it would be nice to add it, so that people know how they are permitted to use it, and any restrictions you're placing on it.
Thanks for considering my request.

Right sort items

Hi @kutlugsahin & @Ne4istb . Could you help me, please? Before, I used method, applyDrag(this.items, dropResult); for right sort items, but now, I see next: Cannot find name 'applyDrag'. What I must be doing now for the right sort ?!

Horizontal layout not expanding width before drop

Hi,

First:

Thanks for a great tool!

Now, I'm trying to build a horizontal layout with groups where you can drop in between groups.
I'm not sure on how to make the group container expand when being hovered with an item.

If I use vertical, the height is altered, but not when it's horizontal.

Please see this simple, not fully working, example. It shows the flaw.
https://stackblitz.com/edit/angular-mqyve9

It's probably something I've missed but would be happy for some guidance.

Thanks,

Cannot read property "reactDropHandler" of undefined

Versions

* @angular/core: 6.0.3
* ngx-smooth-dnd: 0.2.0

Issue

Hello, it's not described in the doc, but I suppose I have to import the NgxSmootDnDModule like in the demo app. But importing this module causes an error.

Repro steps

Stackblitz: https://stackblitz.com/edit/angular-gitter-6kntcb?file=app/app.module.ts

or

  • Create a new app with angular-cli
  • Install ngx-smooth-dnd
  • Import the NgxSmoothModule in the app.module
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { NgxSmoothDnDModule } from 'ngx-smooth-dnd';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgxSmoothDnDModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Observed behavior

The console display this error message and the app does not work:

ngx-smooth-dnd.js:26 Uncaught TypeError: Cannot read property 'reactDropHandler' of undefined
at Object../node_modules/ngx-smooth-dnd/esm5/ngx-smooth-dnd.js (ngx-smooth-dnd.js:26)

update to Angular v6

Can you update the dependencies to the new release of Angular, so we stop getting warnings like:

warning " > [email protected]" has incorrect peer dependency "@angular/common@^5.1.0". warning " > [email protected]" has incorrect peer dependency "@angular/core@^5.1.0".

Remove smooth-dnd-draggable-wrapper overflow: hidden

Hi. I'm using blocks with shadows inside smooth-dnd-draggable and shadows get cutted by "overflow: hidden" on smooth-dnd-draggable-wrapper. I don't see any reason to have this "overflow: hidden" style and overrided it inside project. But could you explain why this style has been added and possibly to remove it if not needed.

getGhostParent not working

I am using ionic 4 with split-pane, to split menu and page, but when dragging is a margin of the column for the card of about 150px and I can not set getGhostParent, have any examples of implementation?

Provide a way to cancel the dragging

Hi
Thanks for your wonderful job.
This is a missing feature that I'm trying hack in, but it seem a little bit too much because I have hack both the Angular version and the original library.

The issue is when you drag and move the mouse outside of the browser window, the elements end in a weird unfinished situation.

I'm trying to fix it by applying this code :

this.renderer.listen('document', 'mouseout', e => {
      const from = e.relatedTarget || e.toElement;
      if (!from || from.nodeName === 'HTML') {
        console.log('**** outside');
      }
      return true;
    });

This is the angular code, but it's easy to understand what's going on.

Thanks so much

npm i ngx-smooth-dnd

Your lib is so awesome but i got a little trouble when i installed

npm i ngx-smooth-dnd

System saved "ngx-smooth-dnd": "^0.2.0" in my package.json file. It's quite old and cards page couldn't work well as it in demo page.
After that, I downloaded your demo and imported from the lib folder in demo. Now everything seems to be OK.
Moreover, I must copy css from your style.css file manually

I just want to notice if you don't know that because i believe that lib can be used more popular if you have time to take care it.

Thank you so much.

Lint error while building the project

I am trying to use this in a project but it breaks my build. Can you kindly look at the following error:

[!] Error: 'constants' is not exported by node_modules/ngx-smooth-dnd/node_modules/smooth-dnd/dist/index.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
node_modules/ngx-smooth-dnd/esm5/ngx-smooth-dnd.js (2:20)
1: import { Component, ViewChild, ContentChildren, Input, Output, EventEmitter, NgZone, NgModule } from '';
2: import SmoothDnD, { constants, dropHandlers } from 'smooth-dnd';
^
3: import { CommonModule } from '';
4: var DraggableComponent = (function () {

Not correct in BoostrapModal

If we try to use this module inside boostrap modal - draggable not positioning in correct place when we drag it.

Example:
image

Touch device dragging error

I'm encountering below error with version 0.2.6. Please help
[Intervention] Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.

dragClass doesn't reflect css cursor attribute

Following your examples I tried adding a grabbing cursor to the ghost item, but with no luck:

.card-ghost {
	transition: transform 0.5s ease;
	transform: rotateZ(5deg);
	opacity: 0.75;
	cursor: -webkit-grabbing;
	cursor: grabbing;
}

Any idea how that can be achieved?

DnD issue about remove node from dom.

I am using this package into angular project. I found one error that mention below. After this error occur my DnD not working. can't drag and nothing happen. I don't know why this error raised and how to solve.

Capture

When I drag one item from lot's of item list (20 items), then automatically this error occur.
When I click on source from where it generate it will move me into vendor js file look like this :

Capture1

Use smooth-dnd-container as a drop zone

Hello,

I need to create a a drop zone for my dnd files, i.e. files from a table list are dragged into a separate drop zone, similar to https://www.dropzonejs.com/. Table list is also smooth-dnd-contaner with smooth-dnd-draggable items.

I got some results with dragEnter/dragLeave functions, but the problem is that dnd-container expects a list of dragables inside abnd dragEnter works only if I drag an item at the very top of container. I just want to have an empty container that will fire onDrop when smooth-dnd-draggable is droped in.

Is there a way to mimic this behavior with smooth-dnd?

Cheers Alex

Angular 9 support?

Hello,

While compiling I've a error:

Error: Failed to compile entry-point ngx-smooth-dnd (es2015 as esm2015) due to compilation errors:
node_modules/@angular/common/common.d.ts:115:22 - error NG6002: Appears in the NgModule.imports of NgxSmoothDnDModule, but could not be resolved to an NgModule class.

Any suggestions ?

ScrollX bug in mobile

When you drop a card while it is moving towards the x-axis, the scroll locks in your direction and cannot return causing you to refresh the page again.
What can be done?
My suggestion is an event so we can control the scroll.

smooth-dnd-draggable' is not a known element

I have followed all the necessary steps and it compiles successfully. But in the browser it shows as follows

Uncaught Error: Template parse errors:
'smooth-dnd-draggable' is not a known element:
1. If 'smooth-dnd-draggable' is an Angular component, then verify that it is part of this module.
2. If 'smooth-dnd-draggable' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("v class="simple-page">
        <smooth-dnd-container (drop)="onDrop($event)">            
          [ERROR ->]<smooth-dnd-draggable *ngFor="let item of items">
            <div class="draggable-item">
          "): ng:///AppModule/AppComponent.html@4:10
'smooth-dnd-container' is not a known element:
1. If 'smooth-dnd-container' is an Angular component, then verify that it is part of this module.
2. If 'smooth-dnd-container' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
    <div>
      <div class="simple-page">
        [ERROR ->]<smooth-dnd-container (drop)="onDrop($event)">            
          <smooth-dnd-draggable *ngFor="le"): ng:///AppModule/AppComponent.html@3:8
    at syntaxError (compiler.js:1021)
    at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:14830)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (compiler.js:24018)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (compiler.js:24005)
    at compiler.js:23948
    at Set.forEach (<anonymous>)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:23948)
    at compiler.js:23858
    at Object.then (compiler.js:1012)
    at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:23857)

What should i do to fix this issue?

Issue with Rearranging card vertically

In vertical orientation, when we try to drag the card from right to left and top to bottom is not working but when I drag from left to right and bottom to top it's working.

angular cli with build-optimizer gives runtime error

When using angular cli version 6.0.5 with a lazy loading route I get following error

Uncaught (in promise): ReferenceError: SmoothDnD is not defined

If i set --build-optimizer=false on ng-cli I don't get that error.

Ngx-smooth-dnd's problems on Google browsers

I used angular-cli to introduce ngx-smooth-dnd, and on the "Card board" page, on Google, when I dragged down the first item of "Ipsum", the first item would not stay where I wanted to stop, but in the last item of "Ipsum". And the problem did not appear on IE and Firefox. Please tell me what caused this. Thank you!

Google:
image

IE:
image

autoScrollEnabled to false is not working

This is how i am using it in my code.
<smooth-dnd-container [groupName]="'draggableItems'" [autoScrollEnabled]="false" (drop)="onDrop('items', $event)">

Can anyone help me if i am not using it properly....
Thanks

Ondrop is not fired when working with sub component

Hi.
When using a sub component that is wrapping smooth-dnd-draggable the drop event is not triggered.
But, if you put smooth-dnd-draggable directly under smooth-dnd-container it is working.
So, the bellow app-draggable will not trigger the onDrop inside id.

Is this as designed?
Thanks

    <smooth-dnd-container  [groupName]='1' (dragStart)="log('drag start', $event)" [orientation]="'horizontal'"  (drop)="onDrop($event,'1')">
         <smooth-dnd-draggable><div id="sadf">THIS IS WORKING</div></smooth-dnd-draggable>
        <app-draggable >THIS WILL NOT WORK</app-draggable> 
      </smooth-dnd-container>

ngx smooth dnd

Hi,
Is it working for Angularjs. I am pretty new for angular and want use drag and drop functionality in my project.
If it is working. Can you tell me how can i use it?

Thanks and Regards
Tanuja

Scale on iOS devices

Hello, i found some bug, when i scale screen and start draging item his position is wrong. Item display not the same position where i touch. Reproduced only on iOS devices, on Android devices work correctly.

Sorry but i can't attach screenshot or video.

No animation for the not dragged item

Versions

* @angular/core: 6.0.2
* ngx-smooth-dnd: 0.2.0
* smooth-dnd: 0.5.4

Observed behavior

No animation for the not dragged item, and the new position of dropped item is sometimes totally wrong.

Repro steps

Stackblitz: https://stackblitz.com/edit/angular-gitter-hlbdjt

Mention any other details that might be useful

I tried to import BrowserAnimationModule and install @angular/animations because I know they are requires for some libraries like angular/material, but it didn't fix the problem.

Could it be related to my last issue or maybe I'm just missing something?

smooth-dnd-draggable class overrided in DraggableComponent::ngAfterViewInit()

When I'm specifying "class" attribute in smooth-dnd-draggable item, this class get replaced by DraggableComponent::ngAfterViewInit() method. I propose to use parentNode.classList.add(constants.wrapperClass)
Also you can inject ElementRef and get reference to current element directly, not from wrapper...
constructor(private elRef: ElementRef){}
ngAfterViewInit() { this.elRef.nativeElement.classList.add(constants.wrapperClass) }

or even better
constructor(private elRef: ElementRef, private renderer: Renderer2){}
ngAfterViewInit() { this.renderer.addClass(this.elRef.nativeElement, constants.wrapperClass); }

integrate it with ngx-datatable

I'm using angular5 and ngx-datatable 11.3.2 How it would be possible to integrate your library within this table to allow to drag columns (headers) with nice animations like in ngx-smooth-dnd?

NotFoundError: Failed to execute 'removeChild' on 'Node':

Current behavior
Hi, I have used this package in my angular-6 project.
I am getting this error when I drag and drop items little fast.

**NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.**

Expected behavior
I just don't want this error, please help me to solve this bug.

  • ngx-smooth-dnd version: ^0.2.6
  • Angular version: ^6.0.0
  • Browser: [all | Chrome | Firefox | IE | Safari | Opera]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]

Using smooth-dnd-container with a regular html table

I'm having difficulty configuring this plugin to reordering rows in a regular html table. I tried:

<table>
  <tbody>
    <smooth-dnd-container>
      <smooth-dnd-draggable>
        <tr><td>something</td><tr>
      </smooth-dnd-draggable>
    <smooth-dnd-container>
  </tbody>
</table>

The problem is that this generates html like the following:

<table>
  <tbody>
    <smooth-dnd-container>
      <div class="smooth-dnd-container vertical">
        <smooth-dnd-draggable>
          <tbody> <!-- this is the problem -->
            <tr><td>something</td><tr>
          <tbody>
        </smooth-dnd-draggable>
      </div>
    </smooth-dnd-container>
  </tbody>
</table>

You can see we generate an extra tbody, which I think is injected by the browser (https://stackoverflow.com/questions/7490364/why-do-browsers-still-inject-tbody-in-html5). Regardless, having the additional tbody causes problems with styling and other functionality. Is there anyway to leverage this library with standard html tables like above?

Draggable bug

Hello, i found some bug when drag item. Test on demo page.
draggable_bug
And in html i have this:
html

container style

Hello mate, at first i want to tell you that you did a great work!
I have a little problem with smooth-dnd-container. I would like to put his own style without parent div that style it. I say this because my container is not translating on orientation vertical good, i dont know if this is cause i'm using Angular material and styles from your library and AM has conflict.

asdf item is dragging but mouse doesnt show it and qwer item doesnt go top

image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.