B: Fix empty constituenta tooltip bug
This commit is contained in:
parent
37d022a030
commit
c97dae223b
|
@ -7,7 +7,7 @@ import { IConstituenta } from '@/models/rsform';
|
|||
import { tooltips } from '@/utils/labels';
|
||||
|
||||
interface ControlsOverlayProps {
|
||||
constituenta?: IConstituenta;
|
||||
constituenta: IConstituenta;
|
||||
disabled: boolean;
|
||||
modified: boolean;
|
||||
processing: boolean;
|
||||
|
@ -37,7 +37,7 @@ function ControlsOverlay({ constituenta, disabled, modified, processing, onRenam
|
|||
)}
|
||||
>
|
||||
<span>Имя </span>
|
||||
<span className='ml-1'>{constituenta?.alias ?? ''}</span>
|
||||
<span className='ml-1'>{constituenta.alias}</span>
|
||||
</div>
|
||||
{!disabled || processing ? (
|
||||
<MiniButton
|
||||
|
|
|
@ -134,6 +134,7 @@ function FormConstituenta({
|
|||
|
||||
return (
|
||||
<AnimateFade className='mx-0 md:mx-auto'>
|
||||
{state ? (
|
||||
<ControlsOverlay
|
||||
disabled={disabled}
|
||||
modified={isModified}
|
||||
|
@ -142,6 +143,7 @@ function FormConstituenta({
|
|||
onEditTerm={onEditTerm}
|
||||
onRename={onRename}
|
||||
/>
|
||||
) : null}
|
||||
<form
|
||||
id={id}
|
||||
className={clsx('cc-column', 'mt-1 w-full md:w-[48.8rem] shrink-0', 'px-6 py-1')}
|
||||
|
@ -157,10 +159,11 @@ function FormConstituenta({
|
|||
onOpenEdit={onOpenEdit}
|
||||
value={term}
|
||||
initialValue={state?.term_raw ?? ''}
|
||||
resolved={state?.term_resolved ?? ''}
|
||||
resolved={state?.term_resolved ?? 'Конституента не выбрана'}
|
||||
disabled={disabled}
|
||||
onChange={newValue => setTerm(newValue)}
|
||||
/>
|
||||
{state ? (
|
||||
<TextArea
|
||||
id='cst_typification'
|
||||
rows={typification.length > ROW_SIZE_IN_CHARACTERS ? 2 : 1}
|
||||
|
@ -172,8 +175,9 @@ function FormConstituenta({
|
|||
value={typification}
|
||||
colors='clr-app clr-text-default'
|
||||
/>
|
||||
) : null}
|
||||
<AnimatePresence>
|
||||
<AnimateFade key='cst_expression_fade' hideContent={!!state && !state?.definition_formal && isElementary}>
|
||||
<AnimateFade key='cst_expression_fade' hideContent={!state || (!state?.definition_formal && isElementary)}>
|
||||
<EditorRSExpression
|
||||
id='cst_expression'
|
||||
label={
|
||||
|
@ -197,7 +201,7 @@ function FormConstituenta({
|
|||
onOpenEdit={onOpenEdit}
|
||||
/>
|
||||
</AnimateFade>
|
||||
<AnimateFade key='cst_definition_fade' hideContent={!!state && !state?.definition_raw && isElementary}>
|
||||
<AnimateFade key='cst_definition_fade' hideContent={!state || (!state?.definition_raw && isElementary)}>
|
||||
<RefsInput
|
||||
id='cst_definition'
|
||||
label='Текстовое определение'
|
||||
|
@ -213,7 +217,7 @@ function FormConstituenta({
|
|||
onChange={newValue => setTextDefinition(newValue)}
|
||||
/>
|
||||
</AnimateFade>
|
||||
<AnimateFade key='cst_convention_fade' hideContent={!showConvention}>
|
||||
<AnimateFade key='cst_convention_fade' hideContent={!showConvention || !state}>
|
||||
<TextArea
|
||||
id='cst_convention'
|
||||
spellCheck
|
||||
|
|
|
@ -79,8 +79,6 @@ function RSTabs() {
|
|||
const cstID = Number(cstQuery);
|
||||
if (cstID && schema?.cstByID.has(cstID)) {
|
||||
setSelected([cstID]);
|
||||
} else if (schema && schema?.items.length > 0) {
|
||||
setSelected([schema.items[0].id]);
|
||||
} else {
|
||||
setSelected([]);
|
||||
}
|
||||
|
|
|
@ -126,13 +126,13 @@ function TableSideConstituents({
|
|||
const conditionalRowStyles = useMemo(
|
||||
(): IConditionalStyle<IConstituenta>[] => [
|
||||
{
|
||||
when: (cst: IConstituenta) => cst.id === activeCst?.id,
|
||||
when: (cst: IConstituenta) => !!activeCst && cst.id === activeCst?.id,
|
||||
style: {
|
||||
backgroundColor: colors.bgSelected
|
||||
}
|
||||
},
|
||||
{
|
||||
when: (cst: IConstituenta) => cst.parent === activeCst?.id && cst.id !== activeCst?.id,
|
||||
when: (cst: IConstituenta) => !!activeCst && cst.parent === activeCst?.id && cst.id !== activeCst?.id,
|
||||
style: {
|
||||
backgroundColor: colors.bgOrange50
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user