Seeking help to solve a puzzling issue that has been occupying my thoughts for the past few days.
The Challenge
I am attempting to incorporate a drag-and-drop functionality that allows users to drag up to 10 items and place them in specified spots (each spot can only hold one item). Once all 10 spots are filled, dragging more items should not be allowed until a spot is cleared.
Currently, I am utilizing the Ngx-Smooth-DND library for drag-and-drop, but I am open to exploring other libraries such as Kendo Sortable if they meet the requirements.
The Issue lies in the fact that the drag-and-drop feature allows multiple items in a list/zone, while I want to restrict it to only one item per zone. Think of it like a quiz where you drag an answer to a specific spot on a diagram - once placed, either replace it by dropping another item or keep the spot empty.
What's Needed
I need to implement a drag-and-drop system where users can drag items from a list of options and drop them into one of ten different zones.
- Variable number of draggable options
- 10 Drop Zones
- Each zone can only have 1 item at a time
Code Snippet
Linking a Stackblitz demonstration of what I am aiming for, along with the Ngx-smooth-dnd library documentation:
https://stackblitz.com/edit/angular-ro3pyw
https://github.com/kutlugsahin/ngx-smooth-dnd
Extra
If there is a more efficient or simpler approach or drag-and-drop library that can achieve this task better, I am completely open to suggestions.