mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-11-15 17:21:38 +03:00
B: Prevent self substitutitons in the UI
This commit is contained in:
parent
ee1e097a91
commit
74a37c029f
|
|
@ -58,18 +58,26 @@ export function PickSubstitutions({
|
||||||
const [rightArgument, setRightArgument] = useState<ILibraryItem | null>(
|
const [rightArgument, setRightArgument] = useState<ILibraryItem | null>(
|
||||||
schemas.length === 1 && allowSelfSubstitution ? schemas[0] : 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 [leftCst, setLeftCst] = useState<IConstituenta | null>(null);
|
||||||
const [rightCst, setRightCst] = 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
|
const rightItems = !rightArgument
|
||||||
? []
|
? []
|
||||||
: (rightArgument as IRSForm).items.filter(
|
: (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);
|
const [deleteRight, setDeleteRight] = useState(true);
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ export const hintMsg = {
|
||||||
versionEmpty: 'Введите шифр версии',
|
versionEmpty: 'Введите шифр версии',
|
||||||
versionTaken: 'Версия с таким шифром уже существует',
|
versionTaken: 'Версия с таким шифром уже существует',
|
||||||
relocateEmpty: 'Необходимо выбрать хотя бы одну собственную конституенту',
|
relocateEmpty: 'Необходимо выбрать хотя бы одну собственную конституенту',
|
||||||
substitutionsEmpty: 'Выберите две различные конституенты',
|
substitutionsEmpty: 'Добавьте хотя бы одно отождествление',
|
||||||
sourceEmpty: 'Выберите схему источник',
|
sourceEmpty: 'Выберите схему источник',
|
||||||
referenceInvalid: 'Выберите тип ссылки и заполните все поля',
|
referenceInvalid: 'Выберите тип ссылки и заполните все поля',
|
||||||
fileEmpty: 'Выберите файл для загрузки'
|
fileEmpty: 'Выберите файл для загрузки'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user