Files
wekan/models/lib/structuralSelection.js
Lauri Ojansivu b0c8acc987 Support mixed multi-selection moves and collapsed drop targets
Select lists, swimlanes, cards and checklist content together. Preserve parent hierarchies, validate move permissions, and create a destination card for checklist content dropped onto a list.

Thanks to xet7 !
2026-09-25 23:35:16 +03:00

10 lines
560 B
JavaScript

'use strict';
const kinds = ['swimlane', 'list', 'card', 'checklist', 'item'];
function selectionRoots(entries) {
const unique = [...new Map(entries.map(entry => [`${entry.kind}:${entry._id}`, entry])).values()];
const selected = new Set(unique.map(entry => `${entry.kind}:${entry._id}`));
return unique.filter(entry => !(entry.ancestors || []).some(key => selected.has(key)))
.sort((a, b) => kinds.indexOf(a.kind) - kinds.indexOf(b.kind) || (a.sort || 0) - (b.sort || 0) || a._id.localeCompare(b._id));
}
module.exports = { kinds, selectionRoots };