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