Added an internal drag zone id/type to DraggableList and its items to restrict items to their respective lists

This commit is contained in:
Dean 2024-01-04 17:20:47 +00:00
parent 0eeabd7883
commit 1aebdea512
1 changed files with 5 additions and 0 deletions

View File

@ -13,6 +13,8 @@
export let draggable = true export let draggable = true
export let focus export let focus
let zoneType = generate()
let store = writable({ let store = writable({
selected: null, selected: null,
actions: { actions: {
@ -46,6 +48,7 @@
return { return {
id: listItemKey ? item[listItemKey] : generate(), id: listItemKey ? item[listItemKey] : generate(),
item, item,
type: zoneType,
} }
}) })
.filter(item => item.id) .filter(item => item.id)
@ -83,6 +86,8 @@
items: draggableItems, items: draggableItems,
dropTargetStyle: { outline: "none" }, dropTargetStyle: { outline: "none" },
dragDisabled: !draggable || inactive, dragDisabled: !draggable || inactive,
type: zoneType,
dropFromOthersDisabled: true,
}} }}
on:finalize={handleFinalize} on:finalize={handleFinalize}
on:consider={updateRowOrder} on:consider={updateRowOrder}