M: Small UI fixes
Some checks are pending
Frontend CI / build (22.x) (push) Waiting to run

This commit is contained in:
Ivan 2024-08-30 20:18:21 +03:00
parent 50452bd92d
commit c0235e573a
7 changed files with 26 additions and 6 deletions

View File

@ -12,7 +12,7 @@ interface InfoConstituentaProps extends CProps.Div {
function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaProps) {
return (
<div className={clsx('dense min-w-[15rem]', className)} {...restProps}>
<div className={clsx('dense min-w-[15rem] break-words', className)} {...restProps}>
<h2>
{data.alias}
{data.is_inherited ? ' (наследуется)' : ''}
@ -28,7 +28,7 @@ function InfoConstituenta({ data, className, ...restProps }: InfoConstituentaPro
<span className='font-math'>{labelCstTypification(data)}</span>
</p>
{data.definition_formal ? (
<p>
<p className='break-all'>
<b>Выражение: </b>
<span className='font-math'>{data.definition_formal}</span>
</p>

View File

@ -90,6 +90,7 @@ function PickConstituenta({
<div className='border divide-y'>
<SearchBar
id={id ? `${id}__search` : undefined}
className='clr-input'
noBorder
value={filterText}
onChange={newValue => setFilterText(newValue)}

View File

@ -24,6 +24,7 @@ export interface ModalProps extends CProps.Styling {
overflowVisible?: boolean;
hideWindow: () => void;
beforeSubmit?: () => boolean;
onSubmit?: () => void;
onCancel?: () => void;
@ -33,6 +34,7 @@ export interface ModalProps extends CProps.Styling {
function Modal({
header,
hideWindow,
beforeSubmit,
onSubmit,
readonly,
onCancel,
@ -53,8 +55,11 @@ function Modal({
};
const handleSubmit = () => {
hideWindow();
if (beforeSubmit && !beforeSubmit()) {
return;
}
if (onSubmit) onSubmit();
hideWindow();
};
return (

View File

@ -16,6 +16,7 @@ import { CstType, ICstCreateData, IRSForm } from '@/models/rsform';
import { generateAlias, validateNewAlias } from '@/models/rsformAPI';
import { inferTemplatedType, substituteTemplateArgs } from '@/models/rslangAPI';
import { PARAMETER } from '@/utils/constants';
import { prompts } from '@/utils/labels';
import FormCreateCst from '../DlgCreateCst/FormCreateCst';
import TabArguments, { IArgumentsState } from './TabArguments';
@ -55,7 +56,18 @@ function DlgConstituentaTemplate({ hideWindow, schema, onCreate, insertAfter }:
});
const [validated, setValidated] = useState(false);
const handleSubmit = () => onCreate(constituenta);
function handleSubmit() {
onCreate(constituenta);
}
function handlePrompt(): boolean {
const definedSomeArgs = substitutes.arguments.some(arg => !!arg.value);
if (!definedSomeArgs && !window.confirm(prompts.templateUndefined)) {
return false;
}
return true;
}
useLayoutEffect(() => {
if (!template.templateID) {
@ -151,6 +163,7 @@ function DlgConstituentaTemplate({ hideWindow, schema, onCreate, insertAfter }:
className='w-[43rem] h-[36.5rem] px-6'
hideWindow={hideWindow}
canSubmit={validated}
beforeSubmit={handlePrompt}
onSubmit={handleSubmit}
>
<Overlay position='top-0 right-[6rem]'>

View File

@ -158,7 +158,7 @@ function EditorRSList({ onOpenEdit }: EditorRSListProps) {
</div>
) : null}
<Overlay position='top-[0.25rem] right-[1rem]' layer='z-navigation'>
<Overlay position='top-[0.25rem] right-[1rem]' layer='z-tooltip'>
<MiniButton
title='Выгрузить в формате CSV'
icon={<IconCSV size='1.25rem' className='icon-green' />}

View File

@ -254,7 +254,7 @@ function MenuRSTabs({ onDestroy }: MenuRSTabsProps) {
text='Порождение структуры'
titleHtml='Раскрыть структуру типизации <br/>выделенной конституенты'
icon={<IconGenerateStructure size='1rem' className='icon-primary' />}
disabled={!controller.isContentEditable || !controller.canProduceStructure}
disabled={!controller.isContentEditable || !controller.canProduceStructure || controller.isProcessing}
onClick={handleProduceStructure}
/>
<DropdownButton

View File

@ -1013,6 +1013,7 @@ export const prompts = {
'Внимание!!\nУдаление операционной схемы приведет к удалению всех операций и собственных концептуальных схем.\nДанное действие нельзя отменить.\nВы уверены, что хотите удалить данную ОСС?',
generateWordforms: 'Данное действие приведет к перезаписи словоформ при совпадении граммем. Продолжить?',
restoreArchive: 'При восстановлении архивной версии актуальная схему будет заменена. Продолжить?',
templateUndefined: 'Вы уверены, что хотите создать шаблонную конституенту не фиксируя аргументы?',
ownerChange:
'Вы уверены, что хотите изменить владельца? Вы потеряете право управления данной схемой. Данное действие отменить нельзя'
};