Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dragging with encapsulation: ViewEncapsulation.Native #15

Closed
hgoraya opened this issue Apr 26, 2016 · 5 comments
Closed

dragging with encapsulation: ViewEncapsulation.Native #15

hgoraya opened this issue Apr 26, 2016 · 5 comments

Comments

@hgoraya
Copy link

hgoraya commented Apr 26, 2016

Really nice work!!
i m trying to drag using directive * dnd-sortable-container* on a container with
"encapsulation: ViewEncapsulation.Native" seems like it doesnt work.

@akserg
Copy link
Owner

akserg commented Apr 26, 2016

Can you copy/paste the code here or give me a link on Plunker or so to have more details?

@hgoraya
Copy link
Author

hgoraya commented Apr 26, 2016

suppose i have following example where i am trying to drag and drop across components i.e. DndDemo and DndDemo2 having same dropzones.(works well if i dont use ViewEncapsulation.Native) but with encapsulation native it fails.(shadowDom)

Component1: "DndDemo"

@component({
selector: 'dnd-demo',
directives: [COMMON_DIRECTIVES, DND_DIRECTIVES,DndDemo2],
encapsulation: ViewEncapsulation.Native,
template:`

Multi list sortable COMPONENT 1






Available boxers

<div class="panel-body" dnd-sortable-container [dropZones]="['boxers-zone']" [sortableData]="listBoxers">

    <li *ngFor="#item of listBoxers; #i = index" class="list-group-item" dnd-sortable [sortableIndex]="i">{{item}}







First Team

<div class="panel-body" dnd-sortable-container [dropZones]="['boxers-zone']" [sortableData]="listTeamOne">

    <li *ngFor="#item of listTeamOne; #i = index" class="list-group-item" dnd-sortable [sortableIndex]="i">{{item}}







Second Team

<div class="panel-body" dnd-sortable-container [dropZones]="['boxers-zone']" [sortableData]="listTeamTwo">

    <li *ngFor="#item of listTeamTwo; #i = index" class="list-group-item" dnd-sortable [sortableIndex]="i">{{item}}




`,
})
export class DndDemo {
listTeamOne: Array = [];
listTeamTwo: Array = [];
listBoxers: Array = ['Sugar Ray Robinson', 'Muhammad Ali', 'George Foreman', 'Joe Frazier', 'Jake LaMotta', 'Joe Louis', 'Jack Dempsey'];
}

Component 2: DndDemo2

@component({
selector: 'dnd-demo2',
directives: [COMMON_DIRECTIVES, DND_DIRECTIVES],
encapsulation: ViewEncapsulation.Native,

template: <h4>Multi list sortable 2 COMPONENT 2 </h4> <div class="row"> <div class="col-sm-33"> <div class="panel panel-warning"> <div class="panel-heading"> Available boxers </div> <div class="panel-body" dnd-sortable-container [dropZones]="['boxers-zone']" [sortableData]="listBoxers1"> <ul class="list-group" > <li *ngFor="#item of listBoxers1; #i = index" class="list-group-item" dnd-sortable [sortableIndex]="i">{{item}}</li> </ul> </div> </div> </div> <div class="col-sm-33"> <div class="panel panel-success"> <div class="panel-heading"> First Team </div> <div class="panel-body" dnd-sortable-container [dropZones]="['boxers-zone']" [sortableData]="listTeamOne1"> <ul class="list-group" > <li *ngFor="#item of listTeamOne1; #i = index" class="list-group-item" dnd-sortable [sortableIndex]="i">{{item}}</li> </ul> </div> </div> </div> <div class="col-sm-33"> <div class="panel panel-info"> <div class="panel-heading"> Second Team </div> <div class="panel-body" dnd-sortable-container [dropZones]="['boxers-zone']" [sortableData]="listTeamTwo2"> <ul class="list-group"> <li *ngFor="#item of listTeamTwo2; #i = index" class="list-group-item" dnd-sortable [sortableIndex]="i">{{item}}</li> </ul> </div> </div> </div> </div>,
styles: ['.col-sm-33 { border: green 2px solid; }']
})
export class DndDemo2 {
listTeamOne1: Array = [];
listTeamTwo2: Array = [];
listBoxers1: Array = ['Sugar Ray Robinson', 'Muhammad Ali', 'George Foreman', 'Joe Frazier', 'Jake LaMotta', 'Joe Louis', 'Jack Dempsey'];
}

@hgoraya
Copy link
Author

hgoraya commented Apr 26, 2016

i guess i am not able to copy whole code here let me try again.

@akserg
Copy link
Owner

akserg commented Apr 26, 2016

Fear enough - let me check what the core of the problem.

@akserg
Copy link
Owner

akserg commented May 16, 2016

As a possible solution have a look into:

The proposal: Use dnd-retarget directive to reach the Drop elements inside Shadow DOM. This directive must be added to the host element of the component contains droppable components. This solution may have the performance issues.

@akserg akserg closed this as completed Sep 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants