Add delete buttons and bar add/create to sub-objects pane
This commit is contained in:
@@ -39,6 +39,7 @@ export function getKindGroups(node) {
|
||||
if (node.instruments.length) {
|
||||
groups.push({ kind: 'instrument', items: node.instruments.map(i => ({
|
||||
kind: 'instrument', node: i, label: i.name, hasChildren: !i.isLinked, readOnly: i.isLinked,
|
||||
deletable: true,
|
||||
}))});
|
||||
}
|
||||
|
||||
@@ -48,13 +49,14 @@ export function getKindGroups(node) {
|
||||
acc[p.scope] = (acc[p.scope] ?? 0) + 1; return acc;
|
||||
}, {});
|
||||
const suffix = Object.entries(counts).map(([s, n]) => `${n} ${s}`).join(', ');
|
||||
return { kind: 'articles', node: a, label: `${a.name} (${suffix})`, hasChildren: false };
|
||||
return { kind: 'articles', node: a, label: `${a.name} (${suffix})`, hasChildren: false, deletable: true };
|
||||
})});
|
||||
}
|
||||
|
||||
if (node.bars.length) {
|
||||
groups.push({ kind: 'bar', items: node.bars.map(b => ({
|
||||
kind: 'bar', node: b, label: b.id, hasChildren: Object.keys(b.voices).length > 0,
|
||||
deletable: true,
|
||||
}))});
|
||||
}
|
||||
|
||||
@@ -66,7 +68,7 @@ export function getKindGroups(node) {
|
||||
return [{ kind: 'variation', items: node.variations.map((v, idx) => ({
|
||||
kind: 'variation', node: v,
|
||||
label: `variation ${idx + 1}${v.dependsOn ? ` (${v.dependsOn})` : ''}`,
|
||||
hasChildren: true,
|
||||
hasChildren: true, deletable: true,
|
||||
}))}];
|
||||
}
|
||||
|
||||
@@ -74,7 +76,7 @@ export function getKindGroups(node) {
|
||||
const groups = [];
|
||||
if (node.labelSpecs.length) {
|
||||
groups.push({ kind: 'label_spec', items: node.labelSpecs.map(ls => ({
|
||||
kind: 'label_spec', node: ls, label: ls.label ?? '(no label)', hasChildren: false,
|
||||
kind: 'label_spec', node: ls, label: ls.label ?? '(no label)', hasChildren: false, deletable: true,
|
||||
}))});
|
||||
}
|
||||
if (node.subvariations.length) {
|
||||
@@ -83,7 +85,7 @@ export function getKindGroups(node) {
|
||||
const label = dep == null ? `subvariation ${idx + 1}`
|
||||
: isNaN(Number(dep)) ? `ATTR: ${dep}`
|
||||
: String(dep);
|
||||
return { kind: 'variation', node: sv, label, hasChildren: true };
|
||||
return { kind: 'variation', node: sv, label, hasChildren: true, deletable: true };
|
||||
})});
|
||||
}
|
||||
return groups;
|
||||
|
||||
Reference in New Issue
Block a user