components icon indicating copy to clipboard operation
components copied to clipboard

Support copying items from source container

Open TKul6 opened this issue 7 years ago • 37 comments
trafficstars

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

When dragging (in order to copy) items from the source container the item should not leave the _initalContainer. In addition, when the item is being copy, the sorting behavior should be disabled (Not sure about that...)

What is the current behavior?

Currently the items can not really be copied to another container, There was basic support developed to solve #13100, but still the UX is not so friendly (the item is disappeared from the source container and then re added), I think it would be best if the item will remained in its old position and not disappear.

What is the use-case or motivation for changing an existing behavior?

The user preform search and then the results appears in a table, I want to be able to copy the items from the search results to designated zones (which might already include items) without loosing the item in the search list

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else we should know?

I started to work about some simple example 4a5b254. (it is in very early stage, but it should explain the basic behavior).

What do you say? Thanks,

TKul6 avatar Oct 31 '18 14:10 TKul6

I too agree with the proposed behavior. It also feels natural for the drop to be able to be in any position instead of the current position from the previous list similar to what occurs in the transferArrayItem.

Example App: https://stackblitz.com/edit/mat-drag-drop-xfdfuh

shanedev6 avatar Nov 15 '18 21:11 shanedev6

I also need this feature. A common use case is pick some component from a components list to view

kingecg avatar Dec 17 '18 09:12 kingecg

Very much needed for repository like UI where you add components by dragging them but they are never removed from the source list

Harpush avatar Nov 24 '19 06:11 Harpush

Check this out, manage to get some "copy" behavior working https://stackblitz.com/edit/angular-krmecd

tchunwei avatar Apr 24 '20 01:04 tchunwei

Check this out, manage to get some "copy" behavior working https://stackblitz.com/edit/angular-krmecd

Thanks @tchunwei Hopefully they can get this functionality implemented natively.

clabough avatar Jun 24 '20 23:06 clabough

We started talking about potential APIs for this today; no ETA or anything like that, but we're thinking about it

jelbourn avatar Jul 20 '20 21:07 jelbourn

Yes, please. Copy behavior without blinking of source item is really needed. @tchunwei thanks for reference

jeneg avatar Jul 24 '20 15:07 jeneg

Any update on this?

DerekJDev avatar Mar 15 '21 23:03 DerekJDev

Check this out, manage to get some "copy" behavior working https://stackblitz.com/edit/angular-krmecd

Method getItemIndex was deprecated in v10

Eve-Sama avatar May 26 '21 09:05 Eve-Sama

Anything happening on this issue?

norsemangrey avatar Oct 28 '21 16:10 norsemangrey

Check this out, manage to get some "copy" behavior working https://stackblitz.com/edit/angular-krmecd

Method getItemIndex was deprecated in v10

https://stackblitz.com/edit/angular-ivy-t4qdiq?file=src/app/app.component.html

you don't need getItemIndex and lodash

kkelyi avatar Nov 08 '21 06:11 kkelyi

@jelbourn had an idea for this problem,

It's a very clunky UX to not be able to show the user where their "dragging" element came from.

copy could simply be a boolean option on origin location options.

I'm open to helping in any way I can.

BenRacicot avatar Dec 17 '21 21:12 BenRacicot

any solution to this issue? I'd love to be able to copy elements from one list to another, I have a very long source list that when gets mutated (element removed from it) it causes performance problems

rodcisal avatar Jan 27 '22 09:01 rodcisal

It will be nice to have this.

avinash1203 avatar Feb 19 '22 07:02 avinash1203

its just a simple flag, can you add this?

avrit avatar Mar 10 '22 17:03 avrit

any solution to this issue? I'd love to be able to copy elements from one list to another, I have a very long source list that when gets mutated (element removed from it) it causes performance problems

Though I'm all for solving this issue, it doesn't sound like a solution to your performance problem. Are you using trackBy? For very very long lists that are simply too much for the browser I'd check out virtual scrolling.

louis-lau avatar Mar 11 '22 22:03 louis-lau

I also have a use for this.

We are building an interactive editor, with the idea that you can drag objects from a list of items into the editor window to add a new instance of that item. Having the ability to copy one cdkDrag into a specific cdkDropList would be lovely

joelkesler avatar May 06 '22 02:05 joelkesler

I have a UI where I need to be able to drag-and-drop employees from the "Employees" area to one or more crews in the "Crews" area. However, employees can be drug to multiple crews, so I don't want them to act like they are leaving the Employees list and then suddenly "reappear" when the drop happens.

image

JWess avatar Jun 13 '22 17:06 JWess

Hey @andrewseguin, is this copying from a source feature no longer being considered for Angular's drag and drop?

BenRacicot avatar Jul 04 '22 18:07 BenRacicot

Any updates on this feature??

JJKid avatar Jan 16 '23 21:01 JJKid

Still waiting for this, would love to get an update from someone!

lappjeff avatar Apr 25 '23 20:04 lappjeff

Just to add another vote for this. It doesn't seem like a complicated request, but there are quite a few use cases that require it...

RandomNameUser avatar May 27 '23 18:05 RandomNameUser

Thread is open since last 4 years. Any update on this feature?

ng-sp7 avatar Aug 17 '23 18:08 ng-sp7

For anybody waiting on this, if you're looking for a solid replacement, check out SortableJS.

DerekJDev avatar Sep 07 '23 18:09 DerekJDev

Any updates on this feature?

Moku151 avatar Sep 19 '23 13:09 Moku151

Any updates on this feature?

Another person asked this a month ago, on this issue that's been open for 5 years. If there were updates, they would be visible here. A bunch of people are subscribed to this issue for actual updates and will get notified when you ask this useless question. Can we all agree to stop asking it? If you have nothing to add to the discussion, just add a +1 to the issue and subscribe to notifications.

louis-lau avatar Sep 19 '23 14:09 louis-lau

I empathize with your frustration regarding my previous comment. However, my intention was to highlight the ongoing demand and importance of addressing this issue. The fact that multiple users keep asking about it underscores the widespread need for a solution.

Moku151 avatar Sep 19 '23 19:09 Moku151

IMO you're both right and I must add that I've copied the CDK's drag-drop package over to a new repo and am working on the stale features I/we need. If you'd like to participate that would be great.

github.com/Recruitler/drag-drop

Finishing nestable drag and drop lists then working on making it an NPM package.

BenRacicot avatar Sep 19 '23 19:09 BenRacicot

While waiting, what are everyone else using instead, or can suggest some temporary solution?

guoliang avatar Oct 29 '23 21:10 guoliang

While waiting, what are everyone else using instead, or can suggest some temporary solution?

I just create another instance of the component while dragging. It's hacky but it works, to the user it looks like it never moves.

louis-lau avatar Oct 29 '23 21:10 louis-lau