B: Fix tooltip clipping after cst==null
This commit is contained in:
parent
51ad937b99
commit
7790cc4ef2
|
@ -171,32 +171,33 @@ function FormConstituenta({
|
||||||
colors='clr-app clr-text-default'
|
colors='clr-app clr-text-default'
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
{state ? (
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
<AnimateFade key='cst_expression_fade' hideContent={!state || (!state?.definition_formal && isElementary)}>
|
<AnimateFade key='cst_expression_fade' hideContent={!state.definition_formal && isElementary}>
|
||||||
<EditorRSExpression
|
<EditorRSExpression
|
||||||
id='cst_expression'
|
id='cst_expression'
|
||||||
label={
|
label={
|
||||||
state?.cst_type === CstType.STRUCTURED
|
state.cst_type === CstType.STRUCTURED
|
||||||
? 'Область определения'
|
? 'Область определения'
|
||||||
: !!state && isFunctional(state.cst_type)
|
: isFunctional(state.cst_type)
|
||||||
? 'Определение функции'
|
? 'Определение функции'
|
||||||
: 'Формальное определение'
|
: 'Формальное определение'
|
||||||
}
|
}
|
||||||
placeholder={
|
placeholder={
|
||||||
state?.cst_type !== CstType.STRUCTURED
|
state.cst_type !== CstType.STRUCTURED
|
||||||
? 'Родоструктурное выражение'
|
? 'Родоструктурное выражение'
|
||||||
: 'Определение множества, которому принадлежат элементы родовой структуры'
|
: 'Определение множества, которому принадлежат элементы родовой структуры'
|
||||||
}
|
}
|
||||||
value={expression}
|
value={expression}
|
||||||
activeCst={state}
|
activeCst={state}
|
||||||
disabled={disabled || state?.is_inherited}
|
disabled={disabled || state.is_inherited}
|
||||||
toggleReset={toggleReset}
|
toggleReset={toggleReset}
|
||||||
onChange={newValue => setExpression(newValue)}
|
onChange={newValue => setExpression(newValue)}
|
||||||
setTypification={setTypification}
|
setTypification={setTypification}
|
||||||
onOpenEdit={onOpenEdit}
|
onOpenEdit={onOpenEdit}
|
||||||
/>
|
/>
|
||||||
</AnimateFade>
|
</AnimateFade>
|
||||||
<AnimateFade key='cst_definition_fade' hideContent={!state || (!state?.definition_raw && isElementary)}>
|
<AnimateFade key='cst_definition_fade' hideContent={!state.definition_raw && isElementary}>
|
||||||
<RefsInput
|
<RefsInput
|
||||||
id='cst_definition'
|
id='cst_definition'
|
||||||
label='Текстовое определение'
|
label='Текстовое определение'
|
||||||
|
@ -206,13 +207,13 @@ function FormConstituenta({
|
||||||
schema={schema}
|
schema={schema}
|
||||||
onOpenEdit={onOpenEdit}
|
onOpenEdit={onOpenEdit}
|
||||||
value={textDefinition}
|
value={textDefinition}
|
||||||
initialValue={state?.definition_raw ?? ''}
|
initialValue={state.definition_raw}
|
||||||
resolved={state?.definition_resolved ?? ''}
|
resolved={state.definition_resolved}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onChange={newValue => setTextDefinition(newValue)}
|
onChange={newValue => setTextDefinition(newValue)}
|
||||||
/>
|
/>
|
||||||
</AnimateFade>
|
</AnimateFade>
|
||||||
<AnimateFade key='cst_convention_fade' hideContent={!showConvention || !state}>
|
<AnimateFade key='cst_convention_fade' hideContent={!showConvention}>
|
||||||
<TextArea
|
<TextArea
|
||||||
id='cst_convention'
|
id='cst_convention'
|
||||||
fitContent
|
fitContent
|
||||||
|
@ -221,7 +222,7 @@ function FormConstituenta({
|
||||||
label={isBasic ? 'Конвенция' : 'Комментарий'}
|
label={isBasic ? 'Конвенция' : 'Комментарий'}
|
||||||
placeholder={isBasic ? 'Договоренность об интерпретации' : 'Пояснение разработчика'}
|
placeholder={isBasic ? 'Договоренность об интерпретации' : 'Пояснение разработчика'}
|
||||||
value={convention}
|
value={convention}
|
||||||
disabled={disabled || (isBasic && state?.is_inherited)}
|
disabled={disabled || (isBasic && state.is_inherited)}
|
||||||
onChange={event => setConvention(event.target.value)}
|
onChange={event => setConvention(event.target.value)}
|
||||||
/>
|
/>
|
||||||
</AnimateFade>
|
</AnimateFade>
|
||||||
|
@ -248,14 +249,14 @@ function FormConstituenta({
|
||||||
icon={<IconSave size='1.25rem' />}
|
icon={<IconSave size='1.25rem' />}
|
||||||
/>
|
/>
|
||||||
<Overlay position='top-[0.1rem] left-[0.4rem]' className='cc-icons'>
|
<Overlay position='top-[0.1rem] left-[0.4rem]' className='cc-icons'>
|
||||||
{state?.is_inherited_parent ? (
|
{state.is_inherited_parent ? (
|
||||||
<MiniButton
|
<MiniButton
|
||||||
icon={<IconPredecessor size='1.25rem' className='clr-text-red' />}
|
icon={<IconPredecessor size='1.25rem' className='clr-text-red' />}
|
||||||
disabled
|
disabled
|
||||||
titleHtml='Внимание!</br> Конституента имеет потомков<br/> в операционной схеме синтеза'
|
titleHtml='Внимание!</br> Конституента имеет потомков<br/> в операционной схеме синтеза'
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{state?.is_inherited ? (
|
{state.is_inherited ? (
|
||||||
<MiniButton
|
<MiniButton
|
||||||
icon={<IconChild size='1.25rem' className='clr-text-red' />}
|
icon={<IconChild size='1.25rem' className='clr-text-red' />}
|
||||||
disabled
|
disabled
|
||||||
|
@ -266,6 +267,7 @@ function FormConstituenta({
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
|
) : null}
|
||||||
</form>
|
</form>
|
||||||
</AnimateFade>
|
</AnimateFade>
|
||||||
);
|
);
|
||||||
|
|
|
@ -28,7 +28,7 @@ import ToolbarRSExpression from './ToolbarRSExpression';
|
||||||
|
|
||||||
interface EditorRSExpressionProps {
|
interface EditorRSExpressionProps {
|
||||||
id?: string;
|
id?: string;
|
||||||
activeCst?: IConstituenta;
|
activeCst: IConstituenta;
|
||||||
value: string;
|
value: string;
|
||||||
label: string;
|
label: string;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
@ -70,13 +70,10 @@ function EditorRSExpression({
|
||||||
|
|
||||||
function handleChange(newValue: string) {
|
function handleChange(newValue: string) {
|
||||||
onChange(newValue);
|
onChange(newValue);
|
||||||
setIsModified(newValue !== activeCst?.definition_formal);
|
setIsModified(newValue !== activeCst.definition_formal);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleCheckExpression(callback?: (parse: IExpressionParse) => void) {
|
function handleCheckExpression(callback?: (parse: IExpressionParse) => void) {
|
||||||
if (!activeCst) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const prefix = getDefinitionPrefix(activeCst);
|
const prefix = getDefinitionPrefix(activeCst);
|
||||||
const expression = prefix + value;
|
const expression = prefix + value;
|
||||||
parser.checkExpression(expression, activeCst, parse => {
|
parser.checkExpression(expression, activeCst, parse => {
|
||||||
|
@ -99,7 +96,7 @@ function EditorRSExpression({
|
||||||
|
|
||||||
const onShowError = useCallback(
|
const onShowError = useCallback(
|
||||||
(error: IRSErrorDescription) => {
|
(error: IRSErrorDescription) => {
|
||||||
if (!activeCst || !rsInput.current) {
|
if (!rsInput.current) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const prefix = getDefinitionPrefix(activeCst);
|
const prefix = getDefinitionPrefix(activeCst);
|
||||||
|
@ -136,7 +133,7 @@ function EditorRSExpression({
|
||||||
toast.error(errors.astFailed);
|
toast.error(errors.astFailed);
|
||||||
} else {
|
} else {
|
||||||
setSyntaxTree(parse.ast);
|
setSyntaxTree(parse.ast);
|
||||||
setExpression(getDefinitionPrefix(activeCst!) + value);
|
setExpression(getDefinitionPrefix(activeCst) + value);
|
||||||
setShowAST(true);
|
setShowAST(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -145,7 +142,7 @@ function EditorRSExpression({
|
||||||
const controls = useMemo(
|
const controls = useMemo(
|
||||||
() => (
|
() => (
|
||||||
<RSEditorControls
|
<RSEditorControls
|
||||||
isOpen={showControls && (!disabled || (model.processing && !activeCst?.is_inherited))}
|
isOpen={showControls && (!disabled || (model.processing && !activeCst.is_inherited))}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
onEdit={handleEdit}
|
onEdit={handleEdit}
|
||||||
/>
|
/>
|
||||||
|
@ -172,7 +169,7 @@ function EditorRSExpression({
|
||||||
<StatusBar
|
<StatusBar
|
||||||
processing={parser.processing}
|
processing={parser.processing}
|
||||||
isModified={isModified}
|
isModified={isModified}
|
||||||
constituenta={activeCst}
|
activeCst={activeCst}
|
||||||
parseData={parser.parseData}
|
parseData={parser.parseData}
|
||||||
onAnalyze={() => handleCheckExpression()}
|
onAnalyze={() => handleCheckExpression()}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -19,11 +19,11 @@ interface StatusBarProps {
|
||||||
processing?: boolean;
|
processing?: boolean;
|
||||||
isModified?: boolean;
|
isModified?: boolean;
|
||||||
parseData?: IExpressionParse;
|
parseData?: IExpressionParse;
|
||||||
constituenta?: IConstituenta;
|
activeCst: IConstituenta;
|
||||||
onAnalyze: () => void;
|
onAnalyze: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function StatusBar({ isModified, processing, constituenta, parseData, onAnalyze }: StatusBarProps) {
|
function StatusBar({ isModified, processing, activeCst, parseData, onAnalyze }: StatusBarProps) {
|
||||||
const { colors } = useConceptOptions();
|
const { colors } = useConceptOptions();
|
||||||
const status = useMemo(() => {
|
const status = useMemo(() => {
|
||||||
if (isModified) {
|
if (isModified) {
|
||||||
|
@ -33,8 +33,8 @@ function StatusBar({ isModified, processing, constituenta, parseData, onAnalyze
|
||||||
const parse = parseData.parseResult ? ParsingStatus.VERIFIED : ParsingStatus.INCORRECT;
|
const parse = parseData.parseResult ? ParsingStatus.VERIFIED : ParsingStatus.INCORRECT;
|
||||||
return inferStatus(parse, parseData.valueClass);
|
return inferStatus(parse, parseData.valueClass);
|
||||||
}
|
}
|
||||||
return inferStatus(constituenta?.parse?.status, constituenta?.parse?.valueClass);
|
return inferStatus(activeCst.parse.status, activeCst.parse.valueClass);
|
||||||
}, [isModified, constituenta, parseData]);
|
}, [isModified, activeCst, parseData]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in New Issue
Block a user