SAP / fundamental-ngx

Fundamental Library for Angular is SAP Design System Angular component library
https://sap.github.io/fundamental-ngx
Apache License 2.0
263 stars 126 forks source link

[Sourcing] <fdp-table> Prevent DND between rows #9718

Closed CSENoni closed 1 year ago

CSENoni commented 1 year ago

Is this a bug, enhancement, or feature request?

enhancement

Briefly describe your proposal.

For DnD, UI is always changed before we can validate which row can be dropped. For example, in table having folders and files, file cannot be dropped on another file, but the UI will still reflect the change from dnd. For now, our workaround is to refresh the whole table to revert the change if we detect that the a dropRow should not be droppable by the dragged row from emitted event. It would be helpful if we can have more control on the UI change for dnd through object property or the emitted event to have some validation between dragged and dropped rows before making change on UI.

Which versions of Angular and Fundamental Library for Angular are affected? (If this is a feature request, use current version.)

Latest

If this is a bug, please provide steps for reproducing it.

Please provide relevant source code if applicable.

Is there anything else we should know?

fkolar commented 1 year ago

This make sense, this needs some additional visuals (UX). if we need to change the dropped area when its disabled. I see the CDK has support for this cdkDropListEnterPredicate. https://material.angular.io/cdk/drag-drop/examples

We just need to expose a @Input as function so application can decide.

@mikerodonnell89

@Input("fdDropEnterPredicate")
enterPredicate: (row: TableRow, dropRow: TableRow, event: FdDropEvent<TableRow>) => boolean = () => true;
CSENoni commented 1 year ago

One found issue https://github.com/SAP/fundamental-ngx/issues/9955

I543348 commented 1 year ago

@CSENoni pls confirm on this issue.

CSENoni commented 1 year ago

@I543348 it is still blocked by https://github.com/SAP/fundamental-ngx/issues/9955. I will recheck after https://github.com/SAP/fundamental-ngx/issues/9955 is resolved.

CSENoni commented 1 year ago

With version v0.42.0-rc.22, this enhancement is working as expected. We can define which row is droppable and other "table functionalities" are still working normally after dnd. Thanks!