поправлен маппинг с отсортированными элементами в инпутах

This commit is contained in:
2026-08-20 11:34:03 +03:00
parent 38aa23cebe
commit 3f2d5caa4a
4 changed files with 35 additions and 13 deletions

View File

@@ -1338,16 +1338,10 @@
}
function mappingInventoryInputs(profile) {
const inputs = Array.isArray(profile?.inventory?.inputs) ? [...profile.inventory.inputs] : [];
const numberValue = (item) => {
const match = String(item?.number ?? "").match(/\d+/);
return match ? Number(match[0]) : Number.MAX_SAFE_INTEGER;
};
return inputs.sort((a, b) => {
const diff = numberValue(a) - numberValue(b);
if (diff) return diff;
return String(a?.title || a?.key || "").localeCompare(String(b?.title || b?.key || ""), "ru", { numeric: true, sensitivity: "base" });
});
// Preserve the exact Input sequence received from the vMix API via Agent.
// The array order is presentation-only: stable Mapping identity still uses
// key -> unique title -> number, so changing Input positions does not break links.
return Array.isArray(profile?.inventory?.inputs) ? [...profile.inventory.inputs] : [];
}
function mappingInputByKey(profile, key, title = "") {