d3lm / ngx-drag-to-select

A lightweight, fast, configurable and reactive drag-to-select component for Angular 10 and beyond
https://www.npmjs.com/package/ngx-drag-to-select
MIT License
293 stars 64 forks source link

Selection lost on update if dtsSelectItem is assigned a value #139

Closed lemmywrap closed 2 years ago

lemmywrap commented 3 years ago

As far as I understand, I can either do: <mat-card [dtsSelectItem]> or the following: <mat-card [dtsSelectItem]="document.id">

When using the latter however, I have noticed that when the items are updated, the selection is reset.

To reproduce, see the following stackblitz

Problem is caused here, I think: https://github.com/d3lm/ngx-drag-to-select/blob/4b12a79d381547ed3ca046d958cb4b1633d535f9/projects/ngx-drag-to-select/src/lib/select-container.component.ts#L347

selectedItems will be of type number[], while newList is of type SelectItemDirective[].

d3lm commented 3 years ago

Thanks for reporting this issue. I am not sure if I have the capacity to look into this right now. Would you be down to fix this and submit a PR?