fix: issues

This commit is contained in:
2026-03-01 10:01:53 +08:00
parent c23bff5a89
commit fdaf79e7ed
7 changed files with 178 additions and 68 deletions
+8 -8
View File
@@ -16,7 +16,7 @@ customElement<MdCommanderProps>(
const commander = useCommander(props.commands);
const [editingAttr, setEditingAttr] = createSignal<{
itemId: string;
index: number;
attrName: string;
attr: TrackerAttribute;
} | null>(null);
@@ -99,13 +99,13 @@ customElement<MdCommanderProps>(
fallback={
<TrackerView
items={commander.trackerItems}
onEditAttribute={(itemId, attrName, attr) =>
setEditingAttr({ itemId, attrName, attr })
onEditAttribute={(index, attrName, attr) =>
setEditingAttr({ index, attrName, attr })
}
onRemoveClass={commander.removeTrackerItemClass}
onMoveUp={(itemId) => commander.moveTrackerItem(itemId, "up")}
onMoveDown={(itemId) => commander.moveTrackerItem(itemId, "down")}
onRemove={commander.removeTrackerItem}
onRemoveClass={commander.removeTrackerItemClassByIndex}
onMoveUp={(index) => commander.moveTrackerItemByIndex(index, "up")}
onMoveDown={(index) => commander.moveTrackerItemByIndex(index, "down")}
onRemove={(index) => commander.removeTrackerItemByIndex(index)}
/>
}
>
@@ -146,7 +146,7 @@ customElement<MdCommanderProps>(
onUpdate={(attr) => {
const data = editingAttr();
if (data) {
commander.updateTrackerAttribute(data.itemId, data.attrName, attr);
commander.updateTrackerAttributeByIndex(data.index, data.attrName, attr);
}
}}
onClose={() => setEditingAttr(null)}