B: Prevent self substitutitons in the UI

This commit is contained in:
Ivan 2025-11-05 16:45:08 +03:00
parent ee1e097a91
commit 74a37c029f
2 changed files with 15 additions and 7 deletions

View File

@ -58,18 +58,26 @@ export function PickSubstitutions({
const [rightArgument, setRightArgument] = useState<ILibraryItem | null>(
schemas.length === 1 && allowSelfSubstitution ? schemas[0] : null
);
const leftItems = !leftArgument
? []
: (leftArgument as IRSForm).items.filter(
cst => !value.find(item => item.original === cst.id) && (!filterCst || filterCst(cst))
);
const [leftCst, setLeftCst] = useState<IConstituenta | null>(null);
const [rightCst, setRightCst] = useState<IConstituenta | null>(null);
const leftItems = !leftArgument
? []
: (leftArgument as IRSForm).items.filter(
cst =>
cst.id !== rightCst?.id && //
!value.find(item => item.original === cst.id) &&
(!filterCst || filterCst(cst))
);
const rightItems = !rightArgument
? []
: (rightArgument as IRSForm).items.filter(
cst => !value.find(item => item.original === cst.id) && (!filterCst || filterCst(cst))
cst =>
cst.id !== leftCst?.id && //
!value.find(item => item.original === cst.id) &&
(!filterCst || filterCst(cst))
);
const [deleteRight, setDeleteRight] = useState(true);

View File

@ -86,7 +86,7 @@ export const hintMsg = {
versionEmpty: 'Введите шифр версии',
versionTaken: 'Версия с таким шифром уже существует',
relocateEmpty: 'Необходимо выбрать хотя бы одну собственную конституенту',
substitutionsEmpty: 'Выберите две различные конституенты',
substitutionsEmpty: 'Добавьте хотя бы одно отождествление',
sourceEmpty: 'Выберите схему источник',
referenceInvalid: 'Выберите тип ссылки и заполните все поля',
fileEmpty: 'Выберите файл для загрузки'