M: Add warning when deleting constituents with children
This commit is contained in:
parent
d0793d0e1c
commit
a1782904a9
|
@ -22,6 +22,10 @@ function DlgDeleteCst({ hideWindow, selected, schema, onDelete }: DlgDeleteCstPr
|
||||||
() => schema.graph.expandAllOutputs(selected), // prettier: split-lines
|
() => schema.graph.expandAllOutputs(selected), // prettier: split-lines
|
||||||
[selected, schema.graph]
|
[selected, schema.graph]
|
||||||
);
|
);
|
||||||
|
const hasInherited = useMemo(
|
||||||
|
() => selected.some(id => schema.inheritance.find(item => item.parent === id), [selected, schema.inheritance]),
|
||||||
|
[selected, schema.inheritance]
|
||||||
|
);
|
||||||
|
|
||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
hideWindow();
|
hideWindow();
|
||||||
|
@ -50,10 +54,13 @@ function DlgDeleteCst({ hideWindow, selected, schema, onDelete }: DlgDeleteCstPr
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label='Удалить зависимые конституенты'
|
label='Удалить зависимые конституенты'
|
||||||
className='my-2'
|
className='mb-2'
|
||||||
value={expandOut}
|
value={expandOut}
|
||||||
setValue={value => setExpandOut(value)}
|
setValue={value => setExpandOut(value)}
|
||||||
/>
|
/>
|
||||||
|
{hasInherited ? (
|
||||||
|
<p className='text-sm clr-text-red'>Внимание! Выбранные конституенты имеют наследников в ОСС</p>
|
||||||
|
) : null}
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user